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: manually unregister only when registered #6259

Conversation

ptoscano
Copy link
Contributor

@ptoscano ptoscano commented Mar 28, 2023

SUMMARY

When registering using D-Bus and using a version of subscription-manager with an unimplemented force option, then unregister manually the system only if it is registered. subscription-manager unregister errors out when trying to unregister an already unregistered system.

Fixes #6258

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

redhat_subscription

ADDITIONAL INFORMATION

Easy reproducer:

  • RHEL 9 older than 9.2, or RHEL 8 older than 8.8, or RHEL 7 and older
  • ensure the system is unregistered, and attempt to register with force_register=true
- name: ensure unregistered
  redhat_subscription:
    state: absent

- name: ensure registered
  redhat_subscription:
    state: present
    force_register: true
    username: "your-username"
    password: "your-password"
    # or activationkey + org_id instead of username + password

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug has_issue module module os packaging plugins plugin (any type) labels Mar 28, 2023
@ptoscano ptoscano force-pushed the redhat_subscription-fix-force branch from 1f3bc7e to f8dd3a9 Compare March 28, 2023 17:05
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-6 labels Mar 28, 2023
When registering using D-Bus and using a version of subscription-manager
with an unimplemented 'force' option, then unregister manually the
system only if it is registered. 'subscription-manager unregister'
errors out when trying to unregister an already unregistered system.
@ptoscano ptoscano force-pushed the redhat_subscription-fix-force branch from f8dd3a9 to 0b61dd2 Compare March 30, 2023 13:41
@felixfontein
Copy link
Collaborator

@ptoscano are you waiting for someone to review this, or should I simply merge?

@ptoscano
Copy link
Contributor Author

ptoscano commented Apr 2, 2023

@ptoscano are you waiting for someone to review this, or should I simply merge?

No, not waiting for other reviewers specifically. Considering the precise bug report, it was easy to create a specific test case, and test it on either RHEL 9 older than 9.2, RHEL 8 older than 8.8, or RHEL 7 and older.

It should be good to go from my POV :) -- sorry again for the breakage due to the recent D-Bus registration work.

@felixfontein felixfontein merged commit c9e11e5 into ansible-collections:main Apr 3, 2023
@patchback
Copy link

patchback bot commented Apr 3, 2023

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/c9e11e5c0c636aefdfdd985d58cfbea4bec42f7f/pr-6259

Backported as #6280

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

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Apr 3, 2023
patchback bot pushed a commit that referenced this pull request Apr 3, 2023
When registering using D-Bus and using a version of subscription-manager
with an unimplemented 'force' option, then unregister manually the
system only if it is registered. 'subscription-manager unregister'
errors out when trying to unregister an already unregistered system.

(cherry picked from commit c9e11e5)
@felixfontein
Copy link
Collaborator

@ptoscano thanks for fixing this!

felixfontein pushed a commit that referenced this pull request Apr 3, 2023
…unregister only when registered (#6280)

redhat_subscription: manually unregister only when registered (#6259)

When registering using D-Bus and using a version of subscription-manager
with an unimplemented 'force' option, then unregister manually the
system only if it is registered. 'subscription-manager unregister'
errors out when trying to unregister an already unregistered system.

(cherry picked from commit c9e11e5)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
@ptoscano ptoscano deleted the redhat_subscription-fix-force branch April 3, 2023 20:41
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_issue module module os packaging plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

redhat_subscription module fails when using "force_register" on non registered system
3 participants