diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-11-04 14:02:42 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-11-04 14:02:42 -0500 |
commit | 49670023591f8eb88dd5860fffc3f8e99764e5a8 (patch) | |
tree | 76adde8b36bde74ffa2282a210df4cc982dcf736 | |
parent | d6502f0ba8da46742975ba41db70d88bc462b7d8 (diff) | |
download | freeipa-49670023591f8eb88dd5860fffc3f8e99764e5a8.tar.gz freeipa-49670023591f8eb88dd5860fffc3f8e99764e5a8.tar.xz freeipa-49670023591f8eb88dd5860fffc3f8e99764e5a8.zip |
Add 'all' option to host-find and pull attributes into a global list
-rw-r--r-- | ipalib/plugins/f_host.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ipalib/plugins/f_host.py b/ipalib/plugins/f_host.py index 4f4f7204..e842230f 100644 --- a/ipalib/plugins/f_host.py +++ b/ipalib/plugins/f_host.py @@ -55,6 +55,7 @@ def validate_host(cn): return 'Fully-qualified hostname required' return None +default_attributes = ['cn','description','localityname','nshostlocation','nshardwareplatform','nsosversion'] class host(frontend.Object): """ @@ -213,6 +214,9 @@ api.register(host_mod) class host_find(crud.Find): 'Search the hosts.' + takes_options = ( + Param('all?', type=ipa_types.Bool(), doc='Retrieve all attributes'), + ) def get_args(self): """ Override Find.get_args() so we can exclude the validation rules @@ -233,6 +237,10 @@ class host_find(crud.Find): # Can't use ldap.get_object_type() since cn is also used for group dns kw['objectclass'] = "ipaHost" + if kw.get('all', False): + kw['attributes'] = ['*'] + else: + kw['attributes'] = default_attributes return ldap.search(**kw) def output_for_cli(self, hosts): if not hosts: @@ -275,7 +283,7 @@ class host_show(crud.Get): if kw.get('all', False): return ldap.retrieve(dn) else: - value = ldap.retrieve(dn, ['cn','description','localityname','nshostlocation','nshardwareplatform','nsosversion']) + value = ldap.retrieve(dn, default_attributes) del value['dn'] return value def output_for_cli(self, host): |