summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-14 11:55:12 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-30 14:50:55 +0200
commitb32fad15d1bb4ba76fcb1abe7120e5eceded0e5c (patch)
treebfb05b91975a13153c144f86637c62131d472f31 /pykolab
parent065556118aaa11bfd287413d12fd775f79618ff1 (diff)
downloadpykolab-b32fad15d1bb4ba76fcb1abe7120e5eceded0e5c.tar.gz
Correct cmd_list_domains to use the configured domain_name_attribute
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/cli/cmd_list_domains.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/pykolab/cli/cmd_list_domains.py b/pykolab/cli/cmd_list_domains.py
index cf12ee4..fd2c7da 100644
--- a/pykolab/cli/cmd_list_domains.py
+++ b/pykolab/cli/cmd_list_domains.py
@@ -22,7 +22,6 @@ import commands
import pykolab
from pykolab.translate import _
-from pykolab import wap_client
log = pykolab.getLogger('pykolab.cli')
conf = pykolab.getConf()
@@ -31,21 +30,23 @@ def __init__():
commands.register('list_domains', execute, description="List Kolab domains.")
def execute(*args, **kw):
+ from pykolab import wap_client
# Create the authentication object.
# TODO: Binds with superuser credentials!
wap_client.authenticate()
domains = wap_client.domains_list()
- #print "domains:", domains['list']
+ dna = conf.get('ldap', 'domain_name_attribute')
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
# with headers and such.
- for domain_dn in domains['list'].keys():
- if isinstance(domains['list'][domain_dn]['associateddomain'], list):
- print domains['list'][domain_dn]['associateddomain'][0]
- for domain_alias in domains['list'][domain_dn]['associateddomain'][1:]:
- print "%-39s %-40s" % ('', domain_alias)
- else:
- print domains['list'][domain_dn]['associateddomain']
+ if isinstance(domains['list'], dict):
+ for domain_dn in domains['list'].keys():
+ if isinstance(domains['list'][domain_dn][dna], list):
+ print domains['list'][domain_dn][dna][0]
+ for domain_alias in domains['list'][domain_dn][dna][1:]:
+ print "%-39s %-40s" % ('', domain_alias)
+ else:
+ print domains['list'][domain_dn][dna]