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

Add option to roles to enforce defaults #567

Merged
merged 11 commits into from
Apr 10, 2023

Conversation

sean-m-sullivan
Copy link
Collaborator

What does this PR do?

As per the discussion an option has been added to multiple roles to enforce defaults.
This option enforces module/api defaults in order to prevent config drift. This makes it so if an option is NOT specified in a configuration it enforces the default value. It is not enabled by default.

I have started with two roles that have multiple options enabled for review. The default environment is not set in orgs as there is an underlying issue with the module and the API where the default value is null, and its hard to pass that through the role->module->api.

I did try to do inline if/else like we do galaxy creds and it did not work
I tried to make my own default filter, but it does not allow for a variable to not be defined.
In the end I settled on a simple lookup plugin to perform the if/else logic and thus provide the default with one value to then work on.

How should this be tested?

This has been turned on in automated tests

Is there a relevant Issue open for this?

#495

ivarmu and others added 5 commits April 8, 2023 18:03
…op#563)

* an inventory source is not ever assigned to an organization

* if no organization, no output for organization field
Copy link
Collaborator

@djdanielsson djdanielsson left a comment

Choose a reason for hiding this comment

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

Questions

changelogs/fragments/enforce_defaults.yml Show resolved Hide resolved
roles/applications/tasks/main.yml Show resolved Hide resolved
@sean-m-sullivan sean-m-sullivan force-pushed the default_v1 branch 4 times, most recently from 6267568 to 4d8b0a3 Compare April 9, 2023 00:31
Copy link
Collaborator

@djdanielsson djdanielsson left a comment

Choose a reason for hiding this comment

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

Can't wait to try it out

@sean-m-sullivan sean-m-sullivan merged commit 1904d54 into redhat-cop:devel Apr 10, 2023
przemkalit pushed a commit to przemkalit/aap_configuration that referenced this pull request Nov 22, 2024
* An inventory source is not ever assigned to an organization (redhat-cop#563)

* an inventory source is not ever assigned to an organization

* if no organization, no output for organization field

* linting

* update workflow

---------

Co-authored-by: Ivan Aragonés Muniesa <26822043+ivarmu@users.noreply.github.com>
przemkalit pushed a commit to przemkalit/aap_configuration that referenced this pull request Nov 22, 2024
* An inventory source is not ever assigned to an organization (redhat-cop#563)

* an inventory source is not ever assigned to an organization

* if no organization, no output for organization field

* linting

* update workflow

---------

Co-authored-by: Ivan Aragonés Muniesa <26822043+ivarmu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants