class Chef::Resource::RhsmRegister
Public Instance Methods
katello_cert_rpm_installed?()
click to toggle source
# File lib/chef/resource/rhsm_register.rb, line 126 def katello_cert_rpm_installed? cmd = Mixlib::ShellOut.new("rpm -qa | grep katello-ca-consumer") cmd.run_command !cmd.stdout.match(/katello-ca-consumer/).nil? end
register_command()
click to toggle source
# File lib/chef/resource/rhsm_register.rb, line 132 def register_command command = %w{subscription-manager register} 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 return command.join(" ") end end if new_resource.username && new_resource.password raise "Unable to register - you must specify environment when using username/password" if new_resource.environment.nil? && using_satellite_host? command << "--username=#{Shellwords.shellescape(new_resource.username)}" command << "--password=#{Shellwords.shellescape(new_resource.password)}" command << "--environment=#{Shellwords.shellescape(new_resource.environment)}" if using_satellite_host? command << "--auto-attach" if new_resource.auto_attach command << "--force" if new_resource.force return command.join(" ") end raise "Unable to create register command - you must specify activation_key or username/password" end
registered_with_rhsm?()
click to toggle source
# File lib/chef/resource/rhsm_register.rb, line 120 def registered_with_rhsm? cmd = Mixlib::ShellOut.new("subscription-manager status", env: { LANG: "en_US" }) cmd.run_command !cmd.stdout.match(/Overall Status: Unknown/) end
using_satellite_host?()
click to toggle source
# File lib/chef/resource/rhsm_register.rb, line 162 def using_satellite_host? !new_resource.satellite_host.nil? end