summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-04-09 18:50:26 +0100
committerGitHub <noreply@github.com>2018-04-09 18:50:26 +0100
commit574a3611bb508a207d06aba1bb9040a4e14837ed (patch)
treeba4aa45535f6698b6d8050708ec37634c0325674
parente7540855ccd0606b5ffc256b66d280da08555c54 (diff)
parent6a9780f3abff5fa7f287e38a57add638a6d59723 (diff)
downloadchef-574a3611bb508a207d06aba1bb9040a4e14837ed.tar.gz
Merge pull request #7133 from chef/fix_pw_rhsm
Fix RHSM registration using passwords
-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 7d4bc12261..05e748e98d 100644
--- a/lib/chef/resource/rhsm_register.rb
+++ b/lib/chef/resource/rhsm_register.rb
@@ -129,14 +129,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