From ea129584cd44537f5c2a7e1ff4054b77b553dcc5 Mon Sep 17 00:00:00 2001 From: George Nikolopoulos Date: Fri, 7 Dec 2018 17:32:30 +0200 Subject: [PATCH] Fix stylebook return value function --- ansible-modules/citrix_adm_stylebook.py | 7 ++++--- .../templates/citrix_adm/citrix_adm_stylebook.template | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ansible-modules/citrix_adm_stylebook.py b/ansible-modules/citrix_adm_stylebook.py index 755027163..46ee0152a 100644 --- a/ansible-modules/citrix_adm_stylebook.py +++ b/ansible-modules/citrix_adm_stylebook.py @@ -247,8 +247,6 @@ def create(self): self.module_result['changed'] = True if not self.module.check_mode: self.create_stylebook() - created_stylebook = self.get_stylebook() - self.module_result.update(dict(stylebook=created_stylebook)) def delete_stylebook(self): # Check if all attributes are present @@ -289,6 +287,9 @@ def main(self): if self.module.params['state'] == 'present': self.create() + if not self.module.check_mode: + created_stylebook = self.get_stylebook() + self.module_result.update(dict(stylebook=created_stylebook)) elif self.module.params['state'] == 'absent': self.delete() @@ -342,4 +343,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/utils/source/templates/citrix_adm/citrix_adm_stylebook.template b/utils/source/templates/citrix_adm/citrix_adm_stylebook.template index 20fe1bd5e..420e394b7 100644 --- a/utils/source/templates/citrix_adm/citrix_adm_stylebook.template +++ b/utils/source/templates/citrix_adm/citrix_adm_stylebook.template @@ -192,8 +192,6 @@ class ModuleExecutor(object): self.module_result['changed'] = True if not self.module.check_mode: self.create_stylebook() - created_stylebook = self.get_stylebook() - self.module_result.update(dict(stylebook=created_stylebook)) def delete_stylebook(self): # Check if all attributes are present @@ -234,6 +232,9 @@ class ModuleExecutor(object): if self.module.params['state'] == 'present': self.create() + if not self.module.check_mode: + created_stylebook = self.get_stylebook() + self.module_result.update(dict(stylebook=created_stylebook)) elif self.module.params['state'] == 'absent': self.delete()