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"
Constants inherited
from LinuxAdmin
VERSION
Instance Method Summary
collapse
method_missing, registration_type
Methods included from Common
#cmd, #run, #run!
Instance Method Details
#all_repos(options) ⇒ Object
75
76
77
78
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 75
def all_repos(options)
available = available_channels_with_status(options)
merge_enabled_channels_with_status(available)
end
|
#available_channels(options) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 68
def available_channels(options)
cmd = "rhn-channel -L"
params = user_pwd(options)
run!(cmd, :params => params).output.chomp.split("\n").compact
end
|
#disable_channel(repo, options) ⇒ Object
Also known as:
disable_repo
52
53
54
55
56
57
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 52
def disable_channel(repo, options)
cmd = "rhn-channel -r"
params = user_pwd(options).merge("--channel=" => repo)
run!(cmd, :params => params)
end
|
#enable_channel(repo, options) ⇒ Object
Also known as:
subscribe, enable_repo
43
44
45
46
47
48
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 43
def enable_channel(repo, options)
cmd = "rhn-channel -a"
params = user_pwd(options).merge("--channel=" => repo)
run!(cmd, :params => params)
end
|
#enabled_channels ⇒ Object
Also known as:
enabled_repos, subscribed_products
60
61
62
63
64
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 60
def enabled_channels
cmd = "rhn-channel -l"
run!(cmd).output.split("\n").compact
end
|
#register(options) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 17
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
run!(cmd, :params => params)
end
|
#registered? ⇒ Boolean
8
9
10
11
12
13
14
15
|
# File 'lib/linux_admin/registration_system/rhn.rb', line 8
def registered?
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
|