From ee25c34d007583a7d6aeee2e5d86a8e93af571c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20R=C3=BCetschi?= Date: Wed, 10 Apr 2019 11:43:56 +0200 Subject: [PATCH] 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. --- lib/ansible/modules/cloud/univention/udm_dns_record.py | 1 + lib/ansible/modules/cloud/univention/udm_dns_zone.py | 1 + lib/ansible/modules/cloud/univention/udm_group.py | 1 + lib/ansible/modules/cloud/univention/udm_share.py | 1 + lib/ansible/modules/cloud/univention/udm_user.py | 1 + 5 files changed, 5 insertions(+) diff --git a/lib/ansible/modules/cloud/univention/udm_dns_record.py b/lib/ansible/modules/cloud/univention/udm_dns_record.py index 1955db5d980..a39c9cccb67 100644 --- a/lib/ansible/modules/cloud/univention/udm_dns_record.py +++ b/lib/ansible/modules/cloud/univention/udm_dns_record.py @@ -123,6 +123,7 @@ def main(): data = module.params['data'] state = module.params['state'] changed = False + diff = None obj = list(ldap_search( '(&(objectClass=dNSZone)(zoneName={0})(relativeDomainName={1}))'.format(zone, name), diff --git a/lib/ansible/modules/cloud/univention/udm_dns_zone.py b/lib/ansible/modules/cloud/univention/udm_dns_zone.py index 261e67149ae..cadb6dd87a9 100644 --- a/lib/ansible/modules/cloud/univention/udm_dns_zone.py +++ b/lib/ansible/modules/cloud/univention/udm_dns_zone.py @@ -170,6 +170,7 @@ def main(): mx = module.params['mx'] state = module.params['state'] changed = False + diff = None obj = list(ldap_search( '(&(objectClass=dNSZone)(zoneName={0}))'.format(zone), diff --git a/lib/ansible/modules/cloud/univention/udm_group.py b/lib/ansible/modules/cloud/univention/udm_group.py index f5a63915cd8..ff00a98a6db 100644 --- a/lib/ansible/modules/cloud/univention/udm_group.py +++ b/lib/ansible/modules/cloud/univention/udm_group.py @@ -112,6 +112,7 @@ def main(): subpath = module.params['subpath'] state = module.params['state'] changed = False + diff = None groups = list(ldap_search( '(&(objectClass=posixGroup)(cn={0}))'.format(name), diff --git a/lib/ansible/modules/cloud/univention/udm_share.py b/lib/ansible/modules/cloud/univention/udm_share.py index 133bd400be4..35aa1e29dbd 100644 --- a/lib/ansible/modules/cloud/univention/udm_share.py +++ b/lib/ansible/modules/cloud/univention/udm_share.py @@ -477,6 +477,7 @@ def main(): name = module.params['name'] state = module.params['state'] changed = False + diff = None obj = list(ldap_search( '(&(objectClass=univentionShare)(cn={0}))'.format(name), diff --git a/lib/ansible/modules/cloud/univention/udm_user.py b/lib/ansible/modules/cloud/univention/udm_user.py index 9c456844ece..cda8d788885 100644 --- a/lib/ansible/modules/cloud/univention/udm_user.py +++ b/lib/ansible/modules/cloud/univention/udm_user.py @@ -413,6 +413,7 @@ def main(): subpath = module.params['subpath'] state = module.params['state'] changed = False + diff = None users = list(ldap_search( '(&(objectClass=posixAccount)(uid={0}))'.format(username),