chef-boneyard / redhat-subscription-manager-cookbook

Cookbook providing custom resources for interacting with Red Hat Subscription Manager
Apache License 2.0
4 stars 18 forks source link

Error running in RHEL7 #12

Closed donwlewis closed 8 years ago

donwlewis commented 8 years ago

I got the following when running in RHEL7:

> Mixlib::ShellOut::ShellCommandFailed
>     ------------------------------------
>     execute[Register to RHSM] (/var/chef/cache/cookbooks/redhat_subscription_manager/libraries/rhsm_register.rb line 53) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource

Here is the code block it is failing on:

rhsm_register node['fqdn'] do
  satellite_host node['rhel-sat']['server']
  activation_key sat_keys[node['node-info']['environment']]
  organization node['rhel-sat']['reg']['org']
  auto_attach true
  install_katello_agent true
end

Running Chef Client version 12.6

donwlewis commented 8 years ago

This section may be helpful as well:

`* execute[Register to RHSM] action run

  ================================================================================
  Error executing action `run` on resource 'execute[Register to RHSM]'
  ================================================================================

  Mixlib::ShellOut::ShellCommandFailed
  ------------------------------------
  Command execution failed. STDOUT/STDERR suppressed for sensitive resource

  Cookbook Trace:
  ---------------
  /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb:119:in `compile_and_converge_action'

  Resource Declaration:
  ---------------------
  suppressed sensitive resource output

  Compiled Resource:
  ------------------
  suppressed sensitive resource output`
donwlewis commented 8 years ago

So this worked when using credentials. Just not with activation keys.

adamleff commented 8 years ago

@donwlewis thanks for the report.

Because Chef would output the command during registration (which would output username/password/activation_key data), I marked this resource as a "sensitive" one to suppress the output. Unfortunately, that does make this a bit harder to debug.

But given the data you've provided, and the fact that this works with username/password, but not with activation_key, I suspect that the activation_key or organization you're passing in is probably incorrect - those two parameters are not used at all when doing username/password registration.

I'd recommend hard-coding them in your recipe for now to debug and get it to work, and then once you've ensured the data is correct, you can place them back as node attributes, etc.

If you're unable to get it to work, you could always create a local copy / fork of this cookbook and remove the sensitive true line here:

https://github.com/chef-partners/redhat-subscription-manager-cookbook/blob/master/libraries/rhsm_register.rb#L54

... which would output the exact command being run as well as the STDOUT/STDERR of the command to help you debug this better. I will expose the ability to disable the sensitive flag via a rhsm_register property in a future release to help users debug this type of issue in the future, as well.

Thanks, Adam

donwlewis commented 8 years ago

Adam,

The following error is what I found:

Error: Activation keys cannot be used with --auto-attach

It seems you can't use auto attach with activation keys.

On Fri, Jan 29, 2016 at 11:21 AM Adam Leff notifications@github.com wrote:

@donwlewis https://github.com/donwlewis thanks for the report.

Because Chef would output the command during registration (which would output username/password/activation_key data), I marked this resource as a "sensitive" one to suppress the output. Unfortunately, that does make this a bit harder to debug.

But given the data you've provided, and the fact that this works with username/password, but not with activation_key, I suspect that the activation_key or organization you're passing in is probably incorrect - those two parameters are not used at all when doing username/password registration.

I'd recommend hard-coding them in your recipe for now to debug and get it to work, and then once you've ensured the data is correct, you can place them back as node attributes, etc.

If you're unable to get it to work, you could always create a local copy / fork of this cookbook and remove the sensitive true line here:

https://github.com/chef-partners/redhat-subscription-manager-cookbook/blob/master/libraries/rhsm_register.rb#L54

... which would output the exact command being run as well as the STDOUT/STDERR of the command to help you debug this better. I will expose the ability to disable the sensitive flag via a rhsm_register property in a future release to help users debug this type of issue in the future, as well.

Thanks, Adam

— Reply to this email directly or view it on GitHub https://github.com/chef-partners/redhat-subscription-manager-cookbook/issues/12#issuecomment-176920551 .

donwlewis commented 8 years ago

Ah. Just noticed you documentation states that. Thanks!

On Fri, Jan 29, 2016 at 11:52 AM Don Lewis don.wayne.lewis@gmail.com wrote:

Adam,

The following error is what I found:

Error: Activation keys cannot be used with --auto-attach

It seems you can't use auto attach with activation keys.

On Fri, Jan 29, 2016 at 11:21 AM Adam Leff notifications@github.com wrote:

@donwlewis https://github.com/donwlewis thanks for the report.

Because Chef would output the command during registration (which would output username/password/activation_key data), I marked this resource as a "sensitive" one to suppress the output. Unfortunately, that does make this a bit harder to debug.

But given the data you've provided, and the fact that this works with username/password, but not with activation_key, I suspect that the activation_key or organization you're passing in is probably incorrect - those two parameters are not used at all when doing username/password registration.

I'd recommend hard-coding them in your recipe for now to debug and get it to work, and then once you've ensured the data is correct, you can place them back as node attributes, etc.

If you're unable to get it to work, you could always create a local copy / fork of this cookbook and remove the sensitive true line here:

https://github.com/chef-partners/redhat-subscription-manager-cookbook/blob/master/libraries/rhsm_register.rb#L54

... which would output the exact command being run as well as the STDOUT/STDERR of the command to help you debug this better. I will expose the ability to disable the sensitive flag via a rhsm_register property in a future release to help users debug this type of issue in the future, as well.

Thanks, Adam

— Reply to this email directly or view it on GitHub https://github.com/chef-partners/redhat-subscription-manager-cookbook/issues/12#issuecomment-176920551 .

adamleff commented 8 years ago

@donwlewis but the code can be smarter and not try to pass in --auto-attach when using an activation key. I'm going to reopen this issue, and I'll fix that in a future release!

adamleff commented 8 years ago

Addressed in #14. Not yet released, but will be included in the next release of the cookbook.