Class: LinuxAdmin::Rhn
Constant Summary
collapse
- SATELLITE5_SERVER_CERT_PATH =
"pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm"
Constants inherited
from LinuxAdmin
VERSION
Instance Method Summary
collapse
method_missing, registration_type
Methods included from Common
#cmd, #run, #run!
Instance Method Details
#register(options) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 16
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]
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]
run!(cmd, :params => params)
end
|
#registered? ⇒ Boolean
7
8
9
10
11
12
13
14
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 7
def registered?
id = ""
if File.exists?(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
|
#subscribe(options) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 40
def subscribe(options)
raise ArgumentError, "channels, username and password are required" if options[:channels].blank? || options[:username].blank? || options[:password].blank?
cmd = "rhn-channel -a"
channels = options[:channels].collect {|channel| ["--channel=", channel]}
params = {}
params["--user="] = options[:username]
params["--password="] = options[:password]
params = params.to_a + channels
run!(cmd, :params => params)
end
|
#subscribed_products ⇒ Object
54
55
56
57
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 54
def subscribed_products
cmd = "rhn-channel -l"
run!(cmd).output.split("\n").compact
end
|