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

RHSM: use 'remove' instead of deprecated 'unregister' #55468

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
4 participants
@EmilienM
Copy link
Contributor

commented Apr 17, 2019

SUMMARY

The new command to unregister is 'remove':

$ subscription-manager -h
remove         Remove all or specific subscriptions from this system
unsubscribe    Deprecated, see remove

And also requires one of --serial, --pool or --all.

$ subscription-manager remove
Error: This command requires that you specify one of --serial, --pool or --all.

This patch:

  • switch unregister to remove.
  • adds --all by default to remove any subscription on the host.
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

redhat_subscription module

RHSM: use 'remove' instead of deprecated 'unregister'
The new command to unregister is 'remove':

$ subscription-manager -h
remove         Remove all or specific subscriptions from this system
unsubscribe    Deprecated, see remove

And also requires one of --serial, --pool or --all.

$ subscription-manager remove
Error: This command requires that you specify one of --serial, --pool or --all.

This patch:
* switch unregister to remove.
* adds --all by default to remove any subscription on the host.
@EmilienM

This comment has been minimized.

Copy link
Contributor Author

commented Apr 17, 2019

ping @samdoran

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

openstack-gerrit pushed a commit to openstack/ansible-role-redhat-subscription that referenced this pull request Apr 18, 2019

unregister: use command to remove the subscription
The RHSM module is broken when unregistering:
ansible/ansible#55468

The new command to unregister is 'remove':

$ subscription-manager -h
remove         Remove all or specific subscriptions from this system
unsubscribe    Deprecated, see remove

And also requires one of --serial, --pool or --all.

$ subscription-manager remove
Error: This command requires that you specify one of --serial, --pool or --all.

Change-Id: I439130e289bc039d718781c43f0fdfef1c31b8be

openstack-gerrit added a commit to openstack/openstack that referenced this pull request Apr 18, 2019

Update git submodules
* Update ansible-role-redhat-subscription from branch 'master'
  - unregister: use command to remove the subscription
    
    The RHSM module is broken when unregistering:
    ansible/ansible#55468
    
    The new command to unregister is 'remove':
    
    $ subscription-manager -h
    remove         Remove all or specific subscriptions from this system
    unsubscribe    Deprecated, see remove
    
    And also requires one of --serial, --pool or --all.
    
    $ subscription-manager remove
    Error: This command requires that you specify one of --serial, --pool or --all.
    
    Change-Id: I439130e289bc039d718781c43f0fdfef1c31b8be
@@ -407,7 +407,7 @@ def unregister(self):
Raises:
* Exception - if error occurs while running command
'''
args = [SUBMAN_CMD, 'unregister']
args = [SUBMAN_CMD, 'remove', '--all']

This comment has been minimized.

Copy link
@mkrizek

mkrizek Apr 18, 2019

Contributor

Out of curiosity, when was remove added? Is there a chance that this will crash on a systems that remove isn't a thing yet? In that case it might be better to have a fallback to unregister.

This comment has been minimized.

Copy link
@EmilienM

EmilienM Apr 18, 2019

Author Contributor

I agree a fallback would be good. I'll add it of course.

This comment has been minimized.

Copy link
@EmilienM

EmilienM Apr 19, 2019

Author Contributor

so in fact the unregister command was removed in 2013: candlepin/subscription-manager@1a98848
Then reverted in 2013 as well: candlepin/subscription-manager@9e08937

Which means both unregister and remove have been supported since 2013... I think we're good to switch to remove now. Let me know what you think.

This comment has been minimized.

Copy link
@samdoran

samdoran Apr 22, 2019

Member

I think switching to remove --all is fine. That matches what is in the Red Hat documentation.

We should try remove --all first, then fall back to unregister if it fails.

@ansibot ansibot removed the needs_triage label Apr 18, 2019

@ansibot ansibot added the stale_ci label Apr 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.