Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab_*_variables deletes all variables in purge mode #7250

Closed
1 task done
MaxBidlingmaier opened this issue Sep 12, 2023 · 3 comments · Fixed by #7251
Closed
1 task done

gitlab_*_variables deletes all variables in purge mode #7250

MaxBidlingmaier opened this issue Sep 12, 2023 · 3 comments · Fixed by #7251
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type)

Comments

@MaxBidlingmaier
Copy link
Contributor

Summary

When using community.general 7.4 to provision gitlab with an exact list of variables (purge:true) all variables get deleted. This took our GitLab env with more then 1000 repos fully offline ;-)

This is due to the change done to the modules without adding the new 'raw' parameter to the list of known parameters in the module_utils/gitlab

Issue Type

Bug Report

Component Name

gitlab_group_variable
gitlab_project_variable

Ansible Version

does not matter

Community.general Version

7.4

Configuration

No response

OS / Environment

any

Steps to Reproduce

---
- hosts: localhost
  gather_facts: false
  vars:
    gv:
      Test:
        value: "12345"
        masked: false
        protected: false
        variable_type: env_var

  tasks:
    - name: test
      community.general.gitlab_group_variable:
        api_url: "https://gitlab/"
        api_token: "secrettoken
        group: "an existing gitlab group"
        purge: true
        vars: "{{ gv }}"

Expected Results

The group varibale Test is set, and no other variable

Actual Results

no variables are set at all

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
MaxBidlingmaier added a commit to MaxBidlingmaier/community.general that referenced this issue Sep 12, 2023
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug has_pr module module plugins plugin (any type) labels Sep 12, 2023
MaxBidlingmaier added a commit to MaxBidlingmaier/community.general that referenced this issue Sep 13, 2023
@mszumilak
Copy link

example 7.3 registered output (no changes):

{
    "changed": false,
    "failed": false,
    "group_variable": {
        "added": [],
        "removed": [],
        "untouched": [
            "id_rsa",
            "TEST_TO_BE_DELETED"
        ],      
        "updated": []
    }
}

example of 7.4 registered output (always changed):

{
    "changed": true,
    "failed": false,
    "group_variable": {
        "added": [],
        "removed": [
            "id_rsa",
            "TEST_TO_BE_DELETED"
        ],
        "untouched": [],
        "updated": [
            "id_rsa",
            "TEST_TO_BE_DELETED"
        ]
    }
}

felixfontein added a commit that referenced this issue Sep 20, 2023
* 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>
patchback bot pushed a commit that referenced this issue Sep 20, 2023
* 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>
(cherry picked from commit fc2e6c4)
felixfontein pushed a commit that referenced this issue Sep 20, 2023
…sing purge (#7294)

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>
(cherry picked from commit fc2e6c4)

Co-authored-by: MaxBidlingmaier <103562872+MaxBidlingmaier@users.noreply.github.com>
etrombly pushed a commit to etrombly/community.general that referenced this issue Oct 25, 2023
* Fixed gitlab_*_variable when using purge, see issue ansible-collections#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants