summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-12-08 16:11:22 -0500
committerAlexander Bokovoy <abokovoy@redhat.com>2011-12-09 14:52:02 +0200
commitd27b23d4315d24e62d83ddf0012b347ffad36e9c (patch)
tree947082342be738d1e6545ef00bd4f90723859709
parentbd4fddf866374f0ac165e9ac65b1c89774b1726a (diff)
downloadfreeipa-d27b23d4315d24e62d83ddf0012b347ffad36e9c.tar.gz
freeipa-d27b23d4315d24e62d83ddf0012b347ffad36e9c.tar.xz
freeipa-d27b23d4315d24e62d83ddf0012b347ffad36e9c.zip
Fix some pylint issues found in F-16
* Using default_attributes rather than what would be defined in output is the preferred mechanism for determining what attributes to retrieve. * Replace some add_s() calls with addEntry()
-rw-r--r--doc/examples/examples.py9
-rw-r--r--ipaserver/install/krbinstance.py4
-rw-r--r--ipaserver/install/service.py2
3 files changed, 10 insertions, 5 deletions
diff --git a/doc/examples/examples.py b/doc/examples/examples.py
index a969c898b..7053e589a 100644
--- a/doc/examples/examples.py
+++ b/doc/examples/examples.py
@@ -314,6 +314,11 @@ class exuser(Object):
),
)
+ # You may not want to return all attributes in the entry by default.
+ # Use default_attributes to limit the list of returned values. The
+ # caller can set all to True to return all attributes.
+ default_attributes = ['uid', 'givenname', 'sn']
+
# register the object, uncomment this line if you want to try it out
#api.register(exuser)
@@ -352,7 +357,7 @@ class exuser_show(Method):
if options.get('all', False):
attrs_list = ['*']
else:
- attrs_list = [p.name for p in self.output_params()]
+ attrs_list = self.obj.default_attributes
(dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
entry_attrs['dn'] = dn
@@ -398,7 +403,7 @@ class exuser_find(Method):
if options.get('all', False):
attrs_list = ['*']
else:
- attrs_list = [p.name for p in self.output_params()]
+ attrs_list = self.obj.default_attributes
# perform the search
(entries, truncated) = ldap.find_entries(
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index ce70c231d..df6fc5a6e 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -284,7 +284,7 @@ class KrbInstance(service.Service):
entry.setValues("nsSaslMapFilterTemplate", '(krbPrincipalName=\\1@\\2)')
try:
- self.admin_conn.add_s(entry)
+ self.admin_conn.addEntry(entry)
except ldap.ALREADY_EXISTS:
logging.critical("failed to add Full Principal Sasl mapping")
raise e
@@ -297,7 +297,7 @@ class KrbInstance(service.Service):
entry.setValues("nsSaslMapFilterTemplate", '(krbPrincipalName=&@%s)' % self.realm)
try:
- self.admin_conn.add_s(entry)
+ self.admin_conn.addEntry(entry)
except ldap.ALREADY_EXISTS:
logging.critical("failed to add Name Only Sasl mapping")
raise e
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 2fd15d8f8..9fcc095b6 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -287,7 +287,7 @@ class Service(object):
"enabledService", "startOrder " + str(order))
try:
- conn.add_s(entry)
+ conn.addEntry(entry)
except ldap.ALREADY_EXISTS, e:
logging.critical("failed to add %s Service startup entry" % name)
raise e