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

respect new variable property in gitlab_group_variable and gitlab_project_variable #5667

Merged
merged 10 commits into from
Dec 10, 2022

Conversation

markuman
Copy link
Member

@markuman markuman commented Dec 8, 2022

SUMMARY

fixes #5666

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

gitlab_project_variable
gitlab_group_variable

ADDITIONAL INFORMATION

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug gitlab has_issue module module plugins plugin (any type) source_control labels Dec 8, 2022
@github-actions
Copy link

github-actions bot commented Dec 8, 2022

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

@markuman markuman changed the title draft: respect new variable property in gitlab_group_variable and gitlab_project_variable respect new variable property in gitlab_group_variable and gitlab_project_variable Dec 8, 2022
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-5 labels Dec 8, 2022
@markuman
Copy link
Member Author

markuman commented Dec 9, 2022

Rework done.
Integration test also passes

gitlab_project_variable
localhost : ok=75 changed=28 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1

gitlab_group_variable
localhost : ok=69 changed=26 unreachable=0 failed=0 skipped=6 rescued=0 ignored=1

@markuman markuman requested review from felixfontein and nejch and removed request for felixfontein and nejch December 9, 2022 08:47
@ansibullbot ansibullbot added the module_utils module_utils label Dec 9, 2022
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Dec 9, 2022
@ansibullbot ansibullbot removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Dec 9, 2022
@markuman markuman requested a review from felixfontein December 9, 2022 11:04
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks good. But I'm not using this module, so maybe someone who does and/or knows it better should also take a look :)

@markuman markuman requested a review from nejch December 9, 2022 13:16

def filter_returned_variables(gitlab_variables):
# pop properties we don't know
existing_variables = [dict(x.attributes) for x in gitlab_variables]
Copy link
Contributor

@nejch nejch Dec 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, x.attributes is already a dict (https://github.com/python-gitlab/python-gitlab/blob/b6c08725042380d20ef5f09979bc29f2f6c1ab6f/gitlab/base.py#L139-L149) (and I agree the list comprehension looked a bit more concise). But feel free to ignore this comment.

Probably outside of the scope of this PR but I'm starting to think at some point there could be 1 source of truth for the KNOWN list (the same is used to construct the dicts in the modules).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If x is a dict, dict(x) creates a copy of it. You could also write x.copy().

Copy link
Contributor

@nejch nejch Dec 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I totally missed that part of the discussion, ignore this :)

Copy link
Contributor

@nejch nejch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just left a non-blocking comment :)

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 10, 2022
@felixfontein felixfontein merged commit c3bc172 into ansible-collections:main Dec 10, 2022
@patchback
Copy link

patchback bot commented Dec 10, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/c3bc172bf6fccdca9c16155da058ce95a57e6076/pr-5667

Backported as #5678

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 10, 2022
…ject_variable (#5667)

* draft

* add changelog fragment

* rework

* rework group variables

* add new line at end of file

* Update plugins/module_utils/gitlab.py

Co-authored-by: Nejc Habjan <[email protected]>

* rename

* revert

* return a copy

* Update plugins/modules/gitlab_project_variable.py

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Nejc Habjan <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit c3bc172)
@patchback
Copy link

patchback bot commented Dec 10, 2022

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/c3bc172bf6fccdca9c16155da058ce95a57e6076/pr-5667

Backported as #5679

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@markuman thank for fixing this!
@nejch thanks for reviewing!

patchback bot pushed a commit that referenced this pull request Dec 10, 2022
…ject_variable (#5667)

* draft

* add changelog fragment

* rework

* rework group variables

* add new line at end of file

* Update plugins/module_utils/gitlab.py

Co-authored-by: Nejc Habjan <[email protected]>

* rename

* revert

* return a copy

* Update plugins/modules/gitlab_project_variable.py

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Nejc Habjan <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit c3bc172)
felixfontein pushed a commit that referenced this pull request Dec 10, 2022
…in gitlab_group_variable and gitlab_project_variable (#5678)

respect new variable property in gitlab_group_variable and gitlab_project_variable (#5667)

* draft

* add changelog fragment

* rework

* rework group variables

* add new line at end of file

* Update plugins/module_utils/gitlab.py

Co-authored-by: Nejc Habjan <[email protected]>

* rename

* revert

* return a copy

* Update plugins/modules/gitlab_project_variable.py

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Nejc Habjan <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit c3bc172)

Co-authored-by: Markus Bergholz <[email protected]>
felixfontein pushed a commit that referenced this pull request Dec 10, 2022
…in gitlab_group_variable and gitlab_project_variable (#5679)

respect new variable property in gitlab_group_variable and gitlab_project_variable (#5667)

* draft

* add changelog fragment

* rework

* rework group variables

* add new line at end of file

* Update plugins/module_utils/gitlab.py

Co-authored-by: Nejc Habjan <[email protected]>

* rename

* revert

* return a copy

* Update plugins/modules/gitlab_project_variable.py

Co-authored-by: Felix Fontein <[email protected]>

Co-authored-by: Nejc Habjan <[email protected]>
Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit c3bc172)

Co-authored-by: Markus Bergholz <[email protected]>
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 gitlab has_issue module_utils module_utils module module plugins plugin (any type) source_control
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gitlab_group_variable deletes all variables when purge is enabled and GitLab API changes
4 participants