Import Upstream version 4.12.4
This commit is contained in:
@@ -39,7 +39,7 @@ class CAACLTracker(Tracker):
|
||||
u'ipamemberca_ca'}
|
||||
category_keys = {
|
||||
u'ipacacategory', u'ipacertprofilecategory', u'usercategory',
|
||||
u'hostcategory', u'servicecategory', u'ipacacategory'}
|
||||
u'hostcategory', u'servicecategory'}
|
||||
retrieve_keys = {
|
||||
u'dn', u'cn', u'description', u'ipaenabledflag',
|
||||
u'ipamemberca', u'ipamembercertprofile', u'memberuser',
|
||||
@@ -49,7 +49,7 @@ class CAACLTracker(Tracker):
|
||||
u'usercategory', u'hostcategory', u'ipacacategory',
|
||||
u'servicecategory', u'ipaenabledflag', u'objectclass',
|
||||
u'ipauniqueid'}
|
||||
update_keys = create_keys - {u'dn'}
|
||||
update_keys = retrieve_keys - {"dn"}
|
||||
|
||||
def __init__(self, name, ipacertprofile_category=None, user_category=None,
|
||||
service_category=None, host_category=None,
|
||||
@@ -105,11 +105,11 @@ class CAACLTracker(Tracker):
|
||||
ipauniqueid=[fuzzy_uuid],
|
||||
cn=[self.name],
|
||||
objectclass=objectclasses.caacl,
|
||||
ipaenabledflag=[u'TRUE'])
|
||||
ipaenabledflag=[True])
|
||||
|
||||
self.attrs.update(self.create_categories)
|
||||
if self.description:
|
||||
self.attrs.update({u'description', [self.description]})
|
||||
self.attrs.update({"description": [self.description]})
|
||||
|
||||
self.exists = True
|
||||
|
||||
@@ -157,7 +157,7 @@ class CAACLTracker(Tracker):
|
||||
def make_update_command(self, updates):
|
||||
return self.make_command('caacl_mod', self.name, **updates)
|
||||
|
||||
def update(self, updates, expected_updates=None, silent=False):
|
||||
def update(self, updates, expected_updates=None):
|
||||
"""If removing a category, delete it from tracker as well"""
|
||||
# filter out empty categories and track changes
|
||||
|
||||
@@ -165,11 +165,7 @@ class CAACLTracker(Tracker):
|
||||
for key, value in updates.items():
|
||||
if key in self.category_keys:
|
||||
if not value:
|
||||
try:
|
||||
del self.attrs[key]
|
||||
except IndexError:
|
||||
if silent:
|
||||
pass
|
||||
del self.attrs[key]
|
||||
else:
|
||||
# if there is a value, prepare the pair for update
|
||||
filtered_updates.update({key: value})
|
||||
@@ -184,12 +180,13 @@ class CAACLTracker(Tracker):
|
||||
try:
|
||||
result = command()
|
||||
except errors.EmptyModlist:
|
||||
if silent:
|
||||
self.attrs.update(filtered_updates)
|
||||
self.attrs.update(expected_updates)
|
||||
self.check_update(result,
|
||||
extra_keys=set(self.update_keys) |
|
||||
set(expected_updates.keys()))
|
||||
pass
|
||||
else:
|
||||
self.attrs.update(filtered_updates)
|
||||
self.attrs.update(expected_updates)
|
||||
self.check_update(result,
|
||||
extra_keys=set(self.update_keys) |
|
||||
set(expected_updates.keys()))
|
||||
|
||||
def check_update(self, result, extra_keys=()):
|
||||
assert_deepequal(dict(
|
||||
@@ -374,10 +371,10 @@ class CAACLTracker(Tracker):
|
||||
|
||||
def enable(self):
|
||||
command = self.make_command(u'caacl_enable', self.name)
|
||||
self.attrs.update({u'ipaenabledflag': [u'TRUE']})
|
||||
self.attrs.update({u'ipaenabledflag': [True]})
|
||||
command()
|
||||
|
||||
def disable(self):
|
||||
command = self.make_command(u'caacl_disable', self.name)
|
||||
self.attrs.update({u'ipaenabledflag': [u'FALSE']})
|
||||
self.attrs.update({u'ipaenabledflag': [False]})
|
||||
command()
|
||||
|
||||
Reference in New Issue
Block a user