The Univention modules have a issue with an unassigned variable. (#55083)

The variable diff is only assigned if state is 'present', else the
variable is unused. But the module will return the diff variable as a
return value. If the state isn't 'present' the module will fail with an
python UnboundLocalError exception.
pull/55087/head
Tobias Rüetschi 6 years ago committed by John R Barker
parent 7adfb1f714
commit ee25c34d00

@ -123,6 +123,7 @@ def main():
data = module.params['data'] data = module.params['data']
state = module.params['state'] state = module.params['state']
changed = False changed = False
diff = None
obj = list(ldap_search( obj = list(ldap_search(
'(&(objectClass=dNSZone)(zoneName={0})(relativeDomainName={1}))'.format(zone, name), '(&(objectClass=dNSZone)(zoneName={0})(relativeDomainName={1}))'.format(zone, name),

@ -170,6 +170,7 @@ def main():
mx = module.params['mx'] mx = module.params['mx']
state = module.params['state'] state = module.params['state']
changed = False changed = False
diff = None
obj = list(ldap_search( obj = list(ldap_search(
'(&(objectClass=dNSZone)(zoneName={0}))'.format(zone), '(&(objectClass=dNSZone)(zoneName={0}))'.format(zone),

@ -112,6 +112,7 @@ def main():
subpath = module.params['subpath'] subpath = module.params['subpath']
state = module.params['state'] state = module.params['state']
changed = False changed = False
diff = None
groups = list(ldap_search( groups = list(ldap_search(
'(&(objectClass=posixGroup)(cn={0}))'.format(name), '(&(objectClass=posixGroup)(cn={0}))'.format(name),

@ -477,6 +477,7 @@ def main():
name = module.params['name'] name = module.params['name']
state = module.params['state'] state = module.params['state']
changed = False changed = False
diff = None
obj = list(ldap_search( obj = list(ldap_search(
'(&(objectClass=univentionShare)(cn={0}))'.format(name), '(&(objectClass=univentionShare)(cn={0}))'.format(name),

@ -413,6 +413,7 @@ def main():
subpath = module.params['subpath'] subpath = module.params['subpath']
state = module.params['state'] state = module.params['state']
changed = False changed = False
diff = None
users = list(ldap_search( users = list(ldap_search(
'(&(objectClass=posixAccount)(uid={0}))'.format(username), '(&(objectClass=posixAccount)(uid={0}))'.format(username),

Loading…
Cancel
Save