89 lines
3.4 KiB
Diff
89 lines
3.4 KiB
Diff
From d27b23d4315d24e62d83ddf0012b347ffad36e9c Mon Sep 17 00:00:00 2001
|
|
From: Rob Crittenden <rcritten@redhat.com>
|
|
Date: Thu, 8 Dec 2011 16:11:22 -0500
|
|
Subject: [PATCH 6/6] 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()
|
|
---
|
|
doc/examples/examples.py | 9 +++++++--
|
|
ipaserver/install/krbinstance.py | 4 ++--
|
|
ipaserver/install/service.py | 2 +-
|
|
3 files changed, 10 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/doc/examples/examples.py b/doc/examples/examples.py
|
|
index a969c898bcf8a6829b83898bd2d68400ae939ff3..7053e589a1a058d7742b51cbceaf683971555621 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 ce70c231dfb7e7b6b59c0496721cced0d09f1604..df6fc5a6ea6fbc4d9c207122dbb3c1ce1f5b4f50 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 2fd15d8f8010114914549871fc5d0a228561fe1c..9fcc095b64f1abc121f1960d7c7ec15dbe53821f 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
|
|
--
|
|
1.7.7.4
|
|
|