You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.
If the the test 'subscription-manager status' fails even though a system is registered, rhsm_register then tries to register again and the registration fails with:
Expected process to exit with [0], but received '64'
---- Begin output of subscription-manager register --activationkey=redacted --org=redacted ----
STDOUT:
STDERR: This system is already registered. Use --force to override
I believe this is due to this block of code in libraries/helpers.rb:
We ran into this too. We worked around this with the following monkey-patch, which we placed into the libraries folder of our wrapper cookbook:
module CubRhsmCookbook
# this is a top-level module documentation comment to please rubocop.
module RhsmHelpers
def registered_with_rhsm?
# err on the side of assuming the system is already registered
#
# we only need systems to register themselves on the first converge
# in the typical case; otherwise avoid errors by assuming a system is
# registered if it looks even slightly like it is registered
#
# product_status.json is a cache of a call to the RHSM API.
# subscription-manager creates this file upon a successful registration
# and deletes it when a system is unregistered cleanly.
File.exist?('/var/lib/rhsm/cache/product_status.json') || super
end
end
end
RhsmCookbook::RhsmRegister.include CubRhsmCookbook::RhsmHelpers
Strictly speaking, this is not an issue with the redhat-subscription-manager-cookbook, but with RHSM and subscription-manager, which fail to return consistent values when a system is already registered.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If the the test 'subscription-manager status' fails even though a system is registered, rhsm_register then tries to register again and the registration fails with:
Expected process to exit with [0], but received '64'
---- Begin output of subscription-manager register --activationkey=redacted --org=redacted ----
STDOUT:
STDERR: This system is already registered. Use --force to override
I believe this is due to this block of code in libraries/helpers.rb:
maybe change registered_with_rhsm? to true on exit status 0, or:
cmd.stdout.match(/Overall Status: Current/)
The text was updated successfully, but these errors were encountered: