Class: LinuxAdmin::Rhn
Constant Summary
collapse
- SATELLITE5_SERVER_CERT_PATH =
"pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm"
- INSTALLED_SERVER_CERT_PATH =
"/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
Instance Method Summary
collapse
method_missing, registration_type
Methods included from Logging
#logger
Constructor Details
#initialize ⇒ Rhn
Returns a new instance of Rhn.
8
9
10
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 8
def initialize
warn("[DEPRECATION] 'LinuxAdmin::Rhn' is deprecated. Please use 'LinuxAdmin::SubscriptionManager' instead.")
end
|
Instance Method Details
#all_repos(options) ⇒ Object
80
81
82
83
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 80
def all_repos(options)
available = available_channels_with_status(options)
merge_enabled_channels_with_status(available)
end
|
#available_channels(options) ⇒ Object
73
74
75
76
77
78
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 73
def available_channels(options)
cmd = "rhn-channel -L"
params = user_pwd(options)
Common.run!(cmd, :params => params).output.chomp.split("\n").compact
end
|
#disable_channel(repo, options) ⇒ Object
Also known as:
disable_repo
57
58
59
60
61
62
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 57
def disable_channel(repo, options)
cmd = "rhn-channel -r"
params = user_pwd(options).merge("--channel=" => repo)
Common.run!(cmd, :params => params)
end
|
#enable_channel(repo, options) ⇒ Object
Also known as:
subscribe, enable_repo
47
48
49
50
51
52
53
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 47
def enable_channel(repo, options)
cmd = "rhn-channel -a"
params = user_pwd(options).merge("--channel=" => repo)
logger.info("#{self.class.name}##{__method__} Enabling channel: #{repo}")
Common.run!(cmd, :params => params)
end
|
#enabled_channels ⇒ Object
Also known as:
enabled_repos, subscribed_products
65
66
67
68
69
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 65
def enabled_channels
cmd = "rhn-channel -l"
Common.run!(cmd).output.split("\n").compact
end
|
#register(options) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 21
def register(options)
cmd = "rhnreg_ks"
params = {}
if options[:activationkey]
params["--activationkey="] = options[:activationkey]
elsif options[:username] && options[:password]
params["--username="] = options[:username]
params["--password="] = options[:password]
else
raise ArgumentError, "activation key or username and password are required"
end
install_server_certificate(options[:server_url], SATELLITE5_SERVER_CERT_PATH) if options[:server_url]
certificate_installed = LinuxAdmin::Rpm.list_installed["rhn-org-trusted-ssl-cert"]
params["--proxy="] = options[:proxy_address] if options[:proxy_address]
params["--proxyUser="] = options[:proxy_username] if options[:proxy_username]
params["--proxyPassword="] = options[:proxy_password] if options[:proxy_password]
params["--serverUrl="] = options[:server_url] if options[:server_url]
params["--systemorgid="] = options[:org] if options[:server_url] && options[:org]
params["--sslCACert="] = INSTALLED_SERVER_CERT_PATH if certificate_installed
Common.run!(cmd, :params => params)
end
|
#registered?(_options = nil) ⇒ Boolean
12
13
14
15
16
17
18
19
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 12
def registered?(_options = nil)
id = ""
if File.exist?(systemid_file)
xml = Nokogiri.XML(File.read(systemid_file))
id = xml.xpath('/params/param/value/struct/member[name="system_id"]/value/string').text
end
id.length > 0
end
|