github_release: Fix state returned from module (#33735)
This fix corrects the module state returned by github_module. Now, * When the release already exists, state is "ok" * When the release is created, state is "changed" Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
b151f5d942
commit
c0df05c028
2 changed files with 18 additions and 5 deletions
|
@ -64,7 +64,12 @@ Modules
|
|||
|
||||
Major changes in popular modules are detailed here
|
||||
|
||||
No notable changes.
|
||||
github_release
|
||||
--------------
|
||||
|
||||
In Ansible versions 2.4 and older, after creating a GitHub release using the ``create_release`` state, the ``github_release`` module reported state as ``skipped``.
|
||||
In Ansible version 2.5 and later, after creating a GitHub release using the ``create_release`` state, the ``github_release`` module now reports state as ``changed``.
|
||||
|
||||
|
||||
Modules removed
|
||||
---------------
|
||||
|
|
|
@ -116,6 +116,15 @@ EXAMPLES = '''
|
|||
'''
|
||||
|
||||
RETURN = '''
|
||||
create_release:
|
||||
description:
|
||||
- Version of the created release
|
||||
- "For Ansible version 2.5 and later, if specified release version already exists, then State is unchanged"
|
||||
- "For Ansible versions prior to 2.5, if specified release version already exists, then State is skipped"
|
||||
type: string
|
||||
returned: success
|
||||
sample: 1.1.0
|
||||
|
||||
latest_release:
|
||||
description: Version of the latest release
|
||||
type: string
|
||||
|
@ -201,15 +210,14 @@ def main():
|
|||
if action == 'create_release':
|
||||
release_exists = repository.release_from_tag(tag)
|
||||
if release_exists:
|
||||
module.exit_json(
|
||||
skipped=True, msg="Release for tag %s already exists." % tag)
|
||||
module.exit_json(changed=False, msg="Release for tag %s already exists." % tag)
|
||||
|
||||
release = repository.create_release(
|
||||
tag, target, name, body, draft, prerelease)
|
||||
if release:
|
||||
module.exit_json(tag=release.tag_name)
|
||||
module.exit_json(changed=True, tag=release.tag_name)
|
||||
else:
|
||||
module.exit_json(tag=None)
|
||||
module.exit_json(changed=False, tag=None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue