mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
gitlab_hook: minor refactoring (#5271)
* gitlab_hook: minor refactoring * add changelog fragment
This commit is contained in:
parent
6b463e6fa6
commit
fbb6ceea1d
2 changed files with 9 additions and 10 deletions
2
changelogs/fragments/5271-gitlab_hook-refactor.yaml
Normal file
2
changelogs/fragments/5271-gitlab_hook-refactor.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- gitlab_hook - minor refactoring (https://github.com/ansible-collections/community.general/pull/5271).
|
|
@ -223,9 +223,8 @@ class GitLabHook(object):
|
|||
hook.save()
|
||||
except Exception as e:
|
||||
self._module.fail_json(msg="Failed to update hook: %s " % e)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
return changed
|
||||
|
||||
'''
|
||||
@param project Project Object
|
||||
|
@ -247,9 +246,9 @@ class GitLabHook(object):
|
|||
changed = False
|
||||
|
||||
for arg_key, arg_value in arguments.items():
|
||||
if arguments[arg_key] is not None:
|
||||
if getattr(hook, arg_key, None) != arguments[arg_key]:
|
||||
setattr(hook, arg_key, arguments[arg_key])
|
||||
if arg_value is not None:
|
||||
if getattr(hook, arg_key, None) != arg_value:
|
||||
setattr(hook, arg_key, arg_value)
|
||||
changed = True
|
||||
|
||||
return (changed, hook)
|
||||
|
@ -277,10 +276,8 @@ class GitLabHook(object):
|
|||
return False
|
||||
|
||||
def delete_hook(self):
|
||||
if self._module.check_mode:
|
||||
return True
|
||||
|
||||
return self.hook_object.delete()
|
||||
if not self._module.check_mode:
|
||||
self.hook_object.delete()
|
||||
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Reference in a new issue