Skip to content

Rhsm_register should fail when underlying command fails #87

@puppetjoy

Description

@puppetjoy

My organization has been using this module for several years. Thank you for it.

We have observed that when host registration fails, the rhsm_register resource returns successfully. This can cause problems for other resources that depend on our rhsm_register resource, and it is confusing trying to identify where the problem is when reading Puppet reports.

For example, if we provide a fake activation key, on the command line we get:

> subscription-manager register --org="dit" --activationkey="fake"
HTTP error (404 - Not Found): Couldn't find activation key 'fake'
> echo $?
70

And providing the same fake activation key to the rhsm_resource, we get:

Notice: /Stage[first]/Satellite_client::Config/Rhsm_register[satellite-server-name]/ensure: created (corrective)

When turning on the --debug option, we see the detailed error message, but the resource is still considered to have returned successfully:

Notice: /Stage[first]/Satellite_client::Config/Rhsm_register[satellite-server-name]/ensure: created (corrective)
Debug: This server will be registered
Debug: Executing: '/usr/sbin/subscription-manager register --activationkey foo --org dit'
Debug: Registration returned: Execution of '/usr/sbin/subscription-manager register --activationkey foo --org dit' returned 70: HTTP error (404 - Not Found): Couldn't find activation key 'foo'

I believe this is because the subscription-manager command failure is caught and not re-raised at https://github.com/waveclaw/puppet-subscription_manager/blob/master/lib/puppet/provider/rhsm_register/subscription_manager.rb#L55. Is there a reason for this? I'm happy to submit a patch if this is something that should be corrected.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions