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

redhat_subscription: Add support for Red Hat API token #5725

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

ecchong
Copy link
Contributor

@ecchong ecchong commented Dec 22, 2022

SUMMARY

Add support using Red Hat API token

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

Updated redhat_subscription.py to allow using Red Hat API token.

ADDITIONAL INFORMATION

Added support for using Red Hat API token in addition to activationkey/org ID or username/password combination.
Following this to generate an access token from the offline token.
https://access.redhat.com/articles/3626371

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor os packaging plugins plugin (any type) labels Dec 22, 2022
@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 22, 2022
@github-actions
Copy link

github-actions bot commented Dec 22, 2022

Docs Build 📝

Thank you for contribution!✨

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

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-6 labels Dec 23, 2022
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.

Thanks for your contribution! Please add a changelog fragment. Thanks.

plugins/modules/redhat_subscription.py Outdated Show resolved Hide resolved
plugins/modules/redhat_subscription.py Show resolved Hide resolved
@felixfontein felixfontein changed the title Add support for Red Hat API token redhat_subscription: Add support for Red Hat API token Dec 23, 2022
@felixfontein
Copy link
Collaborator

CC @ptoscano

@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Dec 23, 2022
@ansibullbot ansibullbot removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Dec 23, 2022
@ptoscano
Copy link
Contributor

ptoscano commented Jan 2, 2023

In principle, this addition sounds OK; I have a couple of notes:

  • please squash your commits: even if it will be done at merging time, the history of "do change"/"fix change"/etc is not exactly helpful
  • please add at least one test case for this: see the TEST_CASES list in tests/unit/plugins/modules/test_redhat_subscription.py

Out of curiosity: how were you able to test this? I know that the Keycloak registration does not work OOTB with subscription.rhsm.redhat.com (see https://bugzilla.redhat.com/show_bug.cgi?id=2115893), and it is not enabled in Satellite.

@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jan 2, 2023
@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 and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jan 2, 2023
@felixfontein
Copy link
Collaborator

This PR currently does multiple modifications in unrelated files that must be undone. Also please note the comments by the bot.

@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot removed the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI label Jan 4, 2023
@ecchong
Copy link
Contributor Author

ecchong commented Jan 4, 2023

It is tested with RHEL8 agains Customer Portal Subscription Management. I am not sure if Satellite support token yet.
The subscription-manager on RHEL9 still having issue with token, but got a different error. Will have to look into it and add test cases.

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jan 4, 2023
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added callback callback plugin cloud web_infrastructure and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jan 4, 2023
@ansibullbot ansibullbot added tests tests unit tests/unit labels Jan 4, 2023
fix mixed up

fix version
@felixfontein
Copy link
Collaborator

Looks good from my POV. If @ptoscano is happy I'll merge.

Copy link
Contributor

@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!

@felixfontein felixfontein merged commit 4dc897d into ansible-collections:main Jan 5, 2023
@patchback
Copy link

patchback bot commented Jan 5, 2023

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/4dc897d559cd631554691a2a4d3d82e34325686c/pr-5725

Backported as #5768

🤖 @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 Jan 5, 2023
Add support for Red Hat API token

fix mixed up

fix version

(cherry picked from commit 4dc897d)
@felixfontein
Copy link
Collaborator

@ecchong thanks for implementing this!
@ptoscano thanks for reviewing!

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 5, 2023
felixfontein pushed a commit that referenced this pull request Jan 5, 2023
…rt for Red Hat API token (#5768)

redhat_subscription: Add support for Red Hat API token (#5725)

Add support for Red Hat API token

fix mixed up

fix version

(cherry picked from commit 4dc897d)

Co-authored-by: Eric C Chong <ecchong@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
callback callback plugin cloud feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor os packaging plugins plugin (any type) tests tests unit tests/unit web_infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants