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

Michael Wood esiotrot at gmail.com
Thu Dec 6 02:13:13 MST 2012


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>


More information about the samba-technical mailing list