[PATCH] samba-tool processes: Make the output a bit nicer

Ricky Nance ricky.nance at weaubleau.k12.mo.us
Fri Dec 7 17:47:13 MST 2012


Hopefully this is the final patch ;) (Sorry, I am still figuring things out
;) ). Jelmer suggested using self.outf.write and putting the
msg_ctx.irpc_all_servers() back inside the nesting.

Ricky


On Thu, Dec 6, 2012 at 9:17 AM, Michael Wood <esiotrot at gmail.com> wrote:

> On 6 December 2012 14:54, Ricky Nance <ricky.nance at weaubleau.k12.mo.us>wrote:
>
>> Michael thanks for the comments, I didn't realize that about .format
>> (what I had read said for versions lower than 3). I thought I had vi setup
>> to report the extra spaces, I will have to look into why thats not working
>> as expected now. Anyway with your revisions here is the new patch.
>>
>> Ricky
>>
>
> Looks good to me.
>
>
>> On Thu, Dec 6, 2012 at 3:13 AM, Michael Wood <esiotrot at gmail.com> wrote:
>>
>>> Hi Ricky
>>>
>>> On 6 December 2012 08:12, Ricky Nance <ricky.nance at weaubleau.k12.mo.us>
>>> wrote:
>>> > This patch makes samba-tool processes output like:
>>> >
>>> > Service:    PID
>>> > ---------------------------------------
>>> > dnsupdate          25964
>>> > nbt_server         25954
>>> > cldap_server       25958
>>> > winbind_server   25961
>>> > kdc_server         25959
>>> > samba                  0
>>> > dreplsrv           25960
>>> > kccsrv             25963
>>> >
>>> > (it looks nicer in a terminal)
>>> >
>>> > I also removed the newline if you use the --name or --pid option as
>>> print
>>> > already gives a newline, so IF someone were to write a script that uses
>>> > this it won't have the extra newline now.
>>>
>>> This looks good, but I have a couple of comments:
>>>
>>> "...".format() doesn't appear to work on Python 2.5 and below.  There
>>> are still people that occasionally pop up on the list trying to use
>>> Python 2.4, so it seems it would be a better idea to use something
>>> like this:
>>>
>>> print "%-16s %6d" % (name.name, server_id.pid)
>>>
>>> Otherwise, some possible nit picks :)
>>>
>>> All the other strings in the patch use double quotes, but the one with
>>> the .format() uses single quotes.
>>>
>>> Also, I think it might be a good idea to avoid the tabs in the output
>>> and just use spaces.
>>>
>>> The print statement with the .format() is indented 5 spaces more than
>>> the previous line instead of the usual 4.
>>>
>>> Regards,
>>> Michael
>>>
>>
> --
> Michael Wood <esiotrot at gmail.com>
>



--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-samba-tool-processes-Make-the-output-a-bit-neater.patch
Type: application/octet-stream
Size: 1688 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20121207/3763c659/attachment.obj>


More information about the samba-technical mailing list