From a973d8e9c4961a48684432c12b72210aac698c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20R=C3=BCetschi?= Date: Tue, 7 Jun 2016 14:48:58 +0200 Subject: [PATCH] UCS udm_share: fix creating of new shares --- lib/ansible/modules/extras/univention/udm_share.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/extras/univention/udm_share.py b/lib/ansible/modules/extras/univention/udm_share.py index a046f3e30d4..deb76742c2c 100644 --- a/lib/ansible/modules/extras/univention/udm_share.py +++ b/lib/ansible/modules/extras/univention/udm_share.py @@ -271,7 +271,7 @@ def main(): sambaMSDFSRoot = dict(type='str', default='0'), sambaName = dict(type='str', - default=''), + default=None), sambaNtAclSupport = dict(type='str', default='1'), sambaOplocks = dict(type='str', @@ -329,15 +329,18 @@ def main(): obj[k] = module.params[k] diff = obj.diff() - for k in obj.keys(): - if obj.hasChanged(k): - changed=True + if exists: + for k in obj.keys(): + if obj.hasChanged(k): + changed=True + else: + changed=True if not module.check_mode: if not exists: obj.create() elif changed: obj.modify() - except BaseException as e: + except Exception as e: module.fail_json( msg='Creating/editing share {} in {} failed: {}'.format(name, container, e) )