summaryrefslogtreecommitdiffstats
path: root/ipalib/aci.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-11-12 13:11:14 -0500
committerJason Gerard DeRose <jderose@redhat.com>2009-11-25 09:38:33 -0700
commit1ea6def129aa459ecc3d176a3b6aebdf75de2eb7 (patch)
treeff5f2bbd42ab6b65df019bf97868005912cf0acf /ipalib/aci.py
parentf14f5156d44296dcd520f083aa6fb912671f49d4 (diff)
downloadfreeipa-1ea6def129aa459ecc3d176a3b6aebdf75de2eb7.tar.gz
freeipa-1ea6def129aa459ecc3d176a3b6aebdf75de2eb7.tar.xz
freeipa-1ea6def129aa459ecc3d176a3b6aebdf75de2eb7.zip
Fix two bugs: one in parsing the ACI and one in comparing two ACIs
The parsing bug was looking for the string 'version' expecting to find the ACI version. This blew up with the attribute nsosversion. Use the string 'version 3.0' instead. The comparison bug appeared if neither ACI had a targetattr attribute. It was trying to create a set out of a None which is illegal. If an ACI doesn't have any targetattrs then return () instead.
Diffstat (limited to 'ipalib/aci.py')
-rwxr-xr-xipalib/aci.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ipalib/aci.py b/ipalib/aci.py
index 88424eecd..bbbfe4196 100755
--- a/ipalib/aci.py
+++ b/ipalib/aci.py
@@ -129,7 +129,7 @@ class ACI:
self.target[var]['expression'] = val
def _parse_acistr(self, acistr):
- vstart = acistr.find('version')
+ vstart = acistr.find('version 3.0')
if vstart < 0:
raise SyntaxError, "malformed ACI, unable to find version %s" % acistr
acimatch = ACIPat.match(acistr[vstart-1:])
@@ -231,10 +231,10 @@ class ACI:
if self.target.get('targetfilter',{}).get('operator') != b.target.get('targetfilter',{}).get('operator'):
return False
- if set(self.target.get('targetattr',{}).get('expression')) != set(b.target.get('targetattr',{}).get('expression')):
- return False
- if self.target.get('targetattr',{}).get('operator') != b.target.get('targetattr',{}).get('operator'):
+ if set(self.target.get('targetattr', {}).get('expression', ())) != set(b.target.get('targetattr',{}).get('expression', ())):
return False
+ if self.target.get('targetattr',{}).get('operator') != b.target.get('targetattr',{}).get('operator'):
+ return False
if self.target.get('target',{}).get('expression') != b.target.get('target',{}).get('expression'):
return False