diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-07-26 11:49:15 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-07-26 11:49:22 -0400 |
commit | ce57b8157eaa6f1b5d4e547bd1ffb41967dfe856 (patch) | |
tree | c10b636ea84e28173573186fc1b10b1b06f4a1ee /src/sbin | |
parent | 982892aebfe43168b44862fa8c79ddc995b1818a (diff) | |
download | bcfg2-ce57b8157eaa6f1b5d4e547bd1ffb41967dfe856.tar.gz bcfg2-ce57b8157eaa6f1b5d4e547bd1ffb41967dfe856.tar.bz2 bcfg2-ce57b8157eaa6f1b5d4e547bd1ffb41967dfe856.zip |
better formatting, display categories in bcfg2-info showclient
Diffstat (limited to 'src/sbin')
-rwxr-xr-x | src/sbin/bcfg2-info | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index 55650f18b..8754fb066 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -531,21 +531,34 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.BaseCore): except: print("Client %s not defined" % client) continue - print("Hostname:\t%s" % client_meta.hostname) - print("Profile:\t%s" % client_meta.profile) - print("Groups:\t\t%s" % list(client_meta.groups)[0]) - for grp in list(client_meta.groups)[1:]: - print("\t\t%s" % grp) + fmt = "%-10s %s" + print(fmt % ("Hostname:", client_meta.hostname)) + print(fmt % ("Profile:", client_meta.profile)) + + group_fmt = "%-10s %-30s %s" + header = False + for group in list(client_meta.groups): + category = "" + for cat, grp in client_meta.categories.items(): + if grp == group: + category = "Category: %s" % cat + break + if not header: + print(group_fmt % ("Groups:", group, category)) + header = True + else: + print(group_fmt % ("", group, category)) + if client_meta.bundles: - print("Bundles:\t%s" % list(client_meta.bundles)[0]) + print(fmt % ("Bundles:", list(client_meta.bundles)[0])) for bnd in list(client_meta.bundles)[1:]: - print("\t\t%s" % bnd) + print(fmt % ("", bnd)) if client_meta.connectors: print("Connector data") print("=" * 80) for conn in client_meta.connectors: if getattr(client_meta, conn): - print("%s:\t%s" % (conn, getattr(client_meta, conn))) + print(fmt % (conn + ":", getattr(client_meta, conn))) print("=" * 80) def do_mappings(self, args): |