mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixed gitlab_*_variable when using purge (#7251)
* Fixed gitlab_*_variable when using purge, see issue #7250 * Update changelogs/fragments/7251-gitlab-variables-deleteing-all-variables.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
9489a1ea1c
commit
fc2e6c4b45
4 changed files with 8 additions and 1 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
bugfixes:
|
||||||
|
- gitlab_project_variable - deleted all variables when used with ``purge=true`` due to missing ``raw`` property in KNOWN attributes (https://github.com/ansible-collections/community.general/issues/7250).
|
||||||
|
- gitlab_group_variable - deleted all variables when used with ``purge=true`` due to missing ``raw`` property in KNOWN attributes (https://github.com/ansible-collections/community.general/issues/7250).
|
|
@ -116,7 +116,7 @@ def gitlab_authentication(module):
|
||||||
def filter_returned_variables(gitlab_variables):
|
def filter_returned_variables(gitlab_variables):
|
||||||
# pop properties we don't know
|
# pop properties we don't know
|
||||||
existing_variables = [dict(x.attributes) for x in gitlab_variables]
|
existing_variables = [dict(x.attributes) for x in gitlab_variables]
|
||||||
KNOWN = ['key', 'value', 'masked', 'protected', 'variable_type', 'environment_scope']
|
KNOWN = ['key', 'value', 'masked', 'protected', 'variable_type', 'environment_scope', 'raw']
|
||||||
for item in existing_variables:
|
for item in existing_variables:
|
||||||
for key in list(item.keys()):
|
for key in list(item.keys()):
|
||||||
if key not in KNOWN:
|
if key not in KNOWN:
|
||||||
|
|
|
@ -381,6 +381,8 @@ def main():
|
||||||
group=dict(type='str', required=True),
|
group=dict(type='str', required=True),
|
||||||
purge=dict(type='bool', required=False, default=False),
|
purge=dict(type='bool', required=False, default=False),
|
||||||
vars=dict(type='dict', required=False, default=dict(), no_log=True),
|
vars=dict(type='dict', required=False, default=dict(), no_log=True),
|
||||||
|
# please mind whenever changing the variables dict to also change module_utils/gitlab.py's
|
||||||
|
# KNOWN dict in filter_returned_variables or bad evil will happen
|
||||||
variables=dict(type='list', elements='dict', required=False, default=list(), options=dict(
|
variables=dict(type='list', elements='dict', required=False, default=list(), options=dict(
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
value=dict(type='str', no_log=True),
|
value=dict(type='str', no_log=True),
|
||||||
|
|
|
@ -404,6 +404,8 @@ def main():
|
||||||
project=dict(type='str', required=True),
|
project=dict(type='str', required=True),
|
||||||
purge=dict(type='bool', required=False, default=False),
|
purge=dict(type='bool', required=False, default=False),
|
||||||
vars=dict(type='dict', required=False, default=dict(), no_log=True),
|
vars=dict(type='dict', required=False, default=dict(), no_log=True),
|
||||||
|
# please mind whenever changing the variables dict to also change module_utils/gitlab.py's
|
||||||
|
# KNOWN dict in filter_returned_variables or bad evil will happen
|
||||||
variables=dict(type='list', elements='dict', required=False, default=list(), options=dict(
|
variables=dict(type='list', elements='dict', required=False, default=list(), options=dict(
|
||||||
name=dict(type='str', required=True),
|
name=dict(type='str', required=True),
|
||||||
value=dict(type='str', no_log=True),
|
value=dict(type='str', no_log=True),
|
||||||
|
|
Loading…
Reference in a new issue