mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-09-30 13:33:21 -07:00
gitlab_*_variable: support masked-and-hidden variables (#10787)
* gitlab_*_variable: support masked-and-hidden variables Support masking and hiding GitLab project and group variables. In the GitLab API, variables that are hidden are also masked by implication. Note gitlab_instance_variable is unmodified since instance variables cannot be hidden. * gitlab_*_variable: add `hidden` to legacy `vars` syntax * gitlab_*_variable: address review comments in doc
This commit is contained in:
parent
cb84a0e99f
commit
3574b3fa93
4 changed files with 42 additions and 9 deletions
|
@ -134,7 +134,7 @@ def gitlab_authentication(module, min_version=None):
|
|||
def filter_returned_variables(gitlab_variables):
|
||||
# pop properties we don't know
|
||||
existing_variables = [dict(x.attributes) for x in gitlab_variables]
|
||||
KNOWN = ['key', 'value', 'masked', 'protected', 'variable_type', 'environment_scope', 'raw']
|
||||
KNOWN = ['key', 'value', 'masked', 'hidden', 'protected', 'variable_type', 'environment_scope', 'raw']
|
||||
for item in existing_variables:
|
||||
for key in list(item.keys()):
|
||||
if key not in KNOWN:
|
||||
|
@ -153,6 +153,7 @@ def vars_to_variables(vars, module):
|
|||
"value": str(value),
|
||||
"masked": False,
|
||||
"protected": False,
|
||||
"hidden": False,
|
||||
"raw": False,
|
||||
"variable_type": "env_var",
|
||||
}
|
||||
|
@ -163,6 +164,7 @@ def vars_to_variables(vars, module):
|
|||
"name": item,
|
||||
"value": value.get('value'),
|
||||
"masked": value.get('masked'),
|
||||
"hidden": value.get('hidden'),
|
||||
"protected": value.get('protected'),
|
||||
"raw": value.get('raw'),
|
||||
"variable_type": value.get('variable_type'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue