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

fix: correctly set release using new behavior of rhsm_release #108

Merged
merged 1 commit into from
Jun 6, 2023

Conversation

richm
Copy link
Contributor

@richm richm commented Jun 2, 2023

The way the new version of rhsm_release works is - if the release
parameter is present, set the release to the given value.
If there is no release parameter, unset the release.
If the user does not set rhc_release, then it will be null,
and calling the rhsm_release module will be skipped.
See ansible-collections/community.general#6401
for details.

Signed-off-by: Rich Megginson [email protected]

@richm richm requested a review from ptoscano as a code owner June 2, 2023 14:34
@ptoscano
Copy link
Collaborator

ptoscano commented Jun 2, 2023

[citest]

@ptoscano
Copy link
Collaborator

ptoscano commented Jun 2, 2023

It'd seem OK at a quick glance; i need to test this manually using tests_release.yml, as a self-deployed Candlepin has no concept of "releases".

@ptoscano
Copy link
Collaborator

ptoscano commented Jun 5, 2023

Unfortunately this does not fix the situation completely, and unsetting a release (i.e. specifying rhc_release {"state":"absent"}) is still broken when using ansible-core 2.15:

argument 'release' is of type <class 'NoneType'> and we were unable to convert to str: 'None' is not a string and conversion is not allowed

this was tested using tests_release.yml using a real account to the internal Stage and a GA RHEL version (i.e. not a nightly/devel one, as those do not have the concept of "release").

The situation is the following:

Yes, a giant mess.

@ptoscano
Copy link
Collaborator

ptoscano commented Jun 5, 2023

Yes, a giant mess.

Let's untangle it by temporarily dropping the support for Fedora: #109.

@richm richm force-pushed the check-for-release-none branch from 3f31f43 to 0178b9f Compare June 5, 2023 17:09
@ptoscano
Copy link
Collaborator

ptoscano commented Jun 6, 2023

OK, created #110 so we can rely on a newer rhsm_release module from community.general.

Because of the new behaviour, we can simplify things a bit: instead of two rhsm_release invocations (depending on whether we need to set or unset a release), they can be merged into one, i.e. passing the "release" parameter when setting or omiting it when unsetting.

@richm richm force-pushed the check-for-release-none branch from 0178b9f to 4395434 Compare June 6, 2023 13:38
@richm richm changed the title fix: skip setting release if rhc_release is none fix: correctly set release using new behavior of rhsm_release Jun 6, 2023
@richm
Copy link
Contributor Author

richm commented Jun 6, 2023

[citest]

The way the new version of rhsm_release works is this:

- if the `release` parameter is present, set the release to the given
  value.
- If there is no `release` parameter, unset the release.

If the user does not set `rhc_release`, or if the user sets it to `omit`
then it will be `null`, and calling the rhsm_release module will be
skipped.
See ansible-collections/community.general#6401
for details.

Signed-off-by: Rich Megginson <[email protected]>
@richm richm force-pushed the check-for-release-none branch from 4395434 to bd50e92 Compare June 6, 2023 16:23
@ptoscano
Copy link
Collaborator

ptoscano commented Jun 6, 2023

[citest]

Copy link
Collaborator

@ptoscano ptoscano left a comment

Choose a reason for hiding this comment

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

Thanks! The release handling LGTM now, and tests_release nicely passes (tested with a Stage account, using a combo of (ansible-core-2.11, ansible-core-2.15) x (rhel-8-8, rhel-9-2)).

I will wait the successful CI run to merge this.

@ptoscano ptoscano merged commit 963f4c8 into linux-system-roles:main Jun 6, 2023
@richm richm deleted the check-for-release-none branch October 13, 2023 13:15
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.

2 participants