Changeset View
Changeset View
Standalone View
Standalone View
pykolab/cli/cmd_list_domains.py
Show All 37 Lines | def execute(*args, **kw): | ||||
dna = conf.get('ldap', 'domain_name_attribute') | dna = conf.get('ldap', 'domain_name_attribute') | ||||
print("%-39s %-40s" % ("Primary Domain Name Space","Secondary Domain Name Space(s)")) | print("%-39s %-40s" % ("Primary Domain Name Space","Secondary Domain Name Space(s)")) | ||||
# TODO: Take a hint in --quiet, and otherwise print out a nice table | # TODO: Take a hint in --quiet, and otherwise print out a nice table | ||||
# with headers and such. | # with headers and such. | ||||
if isinstance(domains['list'], dict): | if isinstance(domains['list'], dict): | ||||
for domain_dn in domains['list'].keys(): | for domain_dn in domains['list']: | ||||
if isinstance(domains['list'][domain_dn][dna], list): | if isinstance(domains['list'][domain_dn][dna], list): | ||||
print(domains['list'][domain_dn][dna][0]) | print(domains['list'][domain_dn][dna][0]) | ||||
for domain_alias in domains['list'][domain_dn][dna][1:]: | for domain_alias in domains['list'][domain_dn][dna][1:]: | ||||
print("%-39s %-40s" % ('', domain_alias)) | print("%-39s %-40s" % ('', domain_alias)) | ||||
else: | else: | ||||
print(domains['list'][domain_dn][dna]) | print(domains['list'][domain_dn][dna]) |