Class: LinuxAdmin::Rhn
Constant Summary
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
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 14
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
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]
run!(cmd, :params => params)
end
|
#registered? ⇒ Boolean
5
6
7
8
9
10
11
12
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 5
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
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 35
def subscribe(options)
raise ArgumentError, "pools, username and password are required" if options[:pools].blank? || options[:username].blank? || options[:password].blank?
cmd = "rhn-channel -a"
pools = options[:pools].collect {|pool| ["--channel=", pool]}
params = {}
params["--user="] = options[:username]
params["--password="] = options[:password]
params = params.to_a + pools
run!(cmd, :params => params)
end
|