summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-04-06 19:26:39 -0400
committerTim Smith <tsmith@chef.io>2018-04-06 19:26:39 -0400
commit6a9780f3abff5fa7f287e38a57add638a6d59723 (patch)
tree13dec1250f9a6376e88b7cafc975db5a5aca3ac0
parente9c34c593d4fcff1642bd572360cd0f83f0e2bb4 (diff)
downloadchef-6a9780f3abff5fa7f287e38a57add638a6d59723.tar.gz
Fix RHSM registration using passwordsfix_pw_rhsm
This fix came into the cookbook repo at https://github.com/chef-partners/redhat-subscription-manager-cookbook/pull/41 Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/rhsm_register.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/chef/resource/rhsm_register.rb b/lib/chef/resource/rhsm_register.rb
index 84bc858575..0fb49ea284 100644
--- a/lib/chef/resource/rhsm_register.rb
+++ b/lib/chef/resource/rhsm_register.rb
@@ -128,14 +128,16 @@ class Chef
def register_command
command = %w{subscription-manager register}
- unless new_resource.activation_key.empty?
- raise "Unable to register - you must specify organization when using activation keys" if new_resource.organization.nil?
+ if new_resource.activation_key
+ unless new_resource.activation_key.empty?
+ raise "Unable to register - you must specify organization when using activation keys" if new_resource.organization.nil?
- command << new_resource.activation_key.map { |key| "--activationkey=#{Shellwords.shellescape(key)}" }
- command << "--org=#{Shellwords.shellescape(new_resource.organization)}"
- command << "--force" if new_resource.force
+ command << new_resource.activation_key.map { |key| "--activationkey=#{Shellwords.shellescape(key)}" }
+ command << "--org=#{Shellwords.shellescape(new_resource.organization)}"
+ command << "--force" if new_resource.force
- return command.join(" ")
+ return command.join(" ")
+ end
end
if new_resource.username && new_resource.password