Closed pgassmann closed 8 years ago
That will be a fundamentally unworkable case.
The registration's name is determined by the name of the Certificate Authority.
That fact reports nil, which appears correct for this case based on the evidence you provided. You do not appear to have a CA setup yet since you've are neither using an RHN certificate which would be detected nor a custom CA certificate.
Puppet cannot create an instance of a type that does not have a name. Furthermore any process of asking to connect to service that does not (yet) exist from the point of view of the client makes no sense.
So the subscription_manager module cannot be used for this case.
It should be possible to switch from RHN to a Satellite.
The Problem is, that the system does have an existing systemid (from rhn), but no rhsm_ca_name, because it is not yet attached to a satellite.
The solution would be to just define no rhsm_register instance if the rhsm_ca_name is not set, instead of failing.
Then it will be properly re-registered when using force => true
yet since you've are neither using an RHN certificate which would be detected nor a custom CA certificate.
The system has a valid subscription status with RHN. But because I define that it should be registered with rhsm, it runs the rhsm_register provider, which finds the systemid and then fails if there is no rhsm_ca_name set.
It would seem to me the best approach is to determine why no rhsm_ca_name is being generated from the valid subscription status with RHN.
Perhaps the free single-use RedHat Enterprise License will work for this test?
I would hope that even self-supported licenses can connect to RHN.
I found the root of the problem.
The format of the output of subscription_manager config --list is different than you expect. The values are in brackets if they do not differ from the default. as you can see in the output above.
I fixed the regular expression in the hostname query to allow the square brackets around the value:
# What host are we configured to register to?
# @return [String] the hostname of the Katello or Satellite service
# or a nil if nothing
# @api private
def self.config_hostname
host = nil
config = subscription_manager(['config','--list'])
config.split("\n").each { |line|
if line =~ /hostname = \[?([a-z0-9.\-_]+)\]?/
host = $1.chomp
end
}
host
end
As always, thanks for the help. Now I need to remind myself go recheck the other custom parsers just in case I missed the defaults case there, too.
While I'm at work I can comment here but I cannot do any work on this module. Sorry.
Versions: RHEL 7.2 waveclaw-facter_cacheable (0.1.0) waveclaw-subscription_manager (2.0.0)
Situation: host was kickstarted with localhost.local and directly to rhn. Now I changed the hostname and want to attach it to a satellite. Plus, the new satellite is not yet reachable, it depends on vpn setup to be done first.