Skip to content

Commit

Permalink
gitlab_instance_variable: Add support for 'raw' property (#9425)
Browse files Browse the repository at this point in the history
* gitlab_instance_variable: Add support for 'raw' property

* Changelog fragment

* Add missing punctuation

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add version_added

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f8bfd5d)
  • Loading branch information
KBjorndal-VizRT authored and patchback[bot] committed Dec 30, 2024
1 parent af2438f commit 168ff6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/9425-gitlab-instance-raw-variable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- gitlab_instance_variable - add support for ``raw`` variables suboption (https://github.com/ansible-collections/community.general/pull/9425).
11 changes: 11 additions & 0 deletions plugins/modules/gitlab_instance_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@
- Whether variable value is protected or not.
type: bool
default: false
raw:
description:
- Whether variable value is raw or not.
- Support for raw values requires GitLab >= 15.7.
type: bool
default: false
version_added: 10.2.0
variable_type:
description:
- Whether a variable is an environment variable (V(env_var)) or a file (V(file)).
Expand Down Expand Up @@ -160,6 +167,7 @@ def create_variable(self, var_obj):
"value": var_obj.get('value'),
"masked": var_obj.get('masked'),
"protected": var_obj.get('protected'),
"raw": var_obj.get('raw'),
"variable_type": var_obj.get('variable_type'),
}

Expand Down Expand Up @@ -227,6 +235,8 @@ def native_python_main(this_gitlab, purge, requested_variables, state, module):
item['protected'] = False
if item.get('masked') is None:
item['masked'] = False
if item.get('raw') is None:
item['raw'] = False
if item.get('variable_type') is None:
item['variable_type'] = 'env_var'

Expand Down Expand Up @@ -297,6 +307,7 @@ def main():
value=dict(type='str', no_log=True),
masked=dict(type='bool', default=False),
protected=dict(type='bool', default=False),
raw=dict(type='bool', default=False),
variable_type=dict(type='str', default='env_var', choices=["env_var", "file"])
)),
state=dict(type='str', default="present", choices=["absent", "present"]),
Expand Down

0 comments on commit 168ff6c

Please sign in to comment.