linux_admin 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/linux_admin/registration_system/rhn.rb +8 -6
- data/lib/linux_admin/version.rb +1 -1
- data/spec/rhn_spec.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzNkYTcwOThkNWI2YzgwODM1M2E3NmIyODA0YjUyMTFmODM1ZWYyZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDIwMWRiNWQyYjUzNDUwMjRkMzZmZDc1Zjc1YjM2ZDgzZmVkNDg5NA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTNiMTg1NTM2YWM4MTczMDgyOTBkMWU0OWVhMTI2MDYzNzJkNWY0NmVjMWZk
|
10
|
+
ZGVkNTgyODkzYzVjNGUzNzAwZDhhMzdmMjAyODg1YjYzMzNlMmYxZWEyODM5
|
11
|
+
ZGQ4MjY1YmE1YWRhZDY3NDdmOTMxMjM4N2IxYzU4NmU1ZjMyZDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWFjZDA3MjViZmI2MGFhYTdlNmJjYmM1MGE5YTZmYWFhYmZmNTcxMjkwMDU3
|
14
|
+
NTdiNWE3OGUxMGJjMGFjNmYzMWM0YzU4MGYwNWQyZjBlYmUwNzExYWUwM2E3
|
15
|
+
ODIyYmIxZTM4NTUyNmI1NDNkYTI1MDk1NGM0MDZjNzM3ZjI1NzY=
|
@@ -3,6 +3,7 @@ require 'nokogiri'
|
|
3
3
|
class LinuxAdmin
|
4
4
|
class Rhn < RegistrationSystem
|
5
5
|
SATELLITE5_SERVER_CERT_PATH = "pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm"
|
6
|
+
INSTALLED_SERVER_CERT_PATH = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
|
6
7
|
|
7
8
|
def registered?
|
8
9
|
id = ""
|
@@ -27,13 +28,14 @@ class LinuxAdmin
|
|
27
28
|
end
|
28
29
|
|
29
30
|
install_server_certificate(options[:server_url], SATELLITE5_SERVER_CERT_PATH) if options[:server_url]
|
31
|
+
certificate_installed = LinuxAdmin::Rpm.list_installed["rhn-org-trusted-ssl-cert"]
|
30
32
|
|
31
|
-
params["--proxy="] = options[:proxy_address]
|
32
|
-
params["--proxyUser="] = options[:proxy_username]
|
33
|
-
params["--proxyPassword="] = options[:proxy_password]
|
34
|
-
params["--serverUrl="] = options[:server_url]
|
35
|
-
params["--systemorgid="] = options[:org]
|
36
|
-
params["--sslCACert="] =
|
33
|
+
params["--proxy="] = options[:proxy_address] if options[:proxy_address]
|
34
|
+
params["--proxyUser="] = options[:proxy_username] if options[:proxy_username]
|
35
|
+
params["--proxyPassword="] = options[:proxy_password] if options[:proxy_password]
|
36
|
+
params["--serverUrl="] = options[:server_url] if options[:server_url]
|
37
|
+
params["--systemorgid="] = options[:org] if options[:server_url] && options[:org]
|
38
|
+
params["--sslCACert="] = INSTALLED_SERVER_CERT_PATH if certificate_installed
|
37
39
|
|
38
40
|
run!(cmd, :params => params)
|
39
41
|
end
|
data/lib/linux_admin/version.rb
CHANGED
data/spec/rhn_spec.rb
CHANGED
@@ -33,15 +33,17 @@ describe LinuxAdmin::Rhn do
|
|
33
33
|
:server_cert => "/path/to/cert",
|
34
34
|
}
|
35
35
|
}
|
36
|
-
let(:run_params) { {:params=>{"--username="=>"SomeUser@SomeDomain.org", "--password="=>"SomePass", "--proxy="=>"1.2.3.4", "--proxyUser="=>"ProxyUser", "--proxyPassword="=>"ProxyPass"
|
36
|
+
let(:run_params) { {:params=>{"--username="=>"SomeUser@SomeDomain.org", "--password="=>"SomePass", "--proxy="=>"1.2.3.4", "--proxyUser="=>"ProxyUser", "--proxyPassword="=>"ProxyPass"}} }
|
37
37
|
|
38
38
|
it "with server_url" do
|
39
39
|
run_params.store_path(:params, "--systemorgid=", "2")
|
40
40
|
run_params.store_path(:params, "--serverUrl=", "https://server.url")
|
41
|
+
run_params.store_path(:params, "--sslCACert=", "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT")
|
41
42
|
base_options.store_path(:server_url, "https://server.url")
|
42
43
|
|
43
44
|
described_class.any_instance.should_receive(:run!).once.with("rhnreg_ks", run_params)
|
44
45
|
LinuxAdmin::Rpm.should_receive(:upgrade).with("http://server.url/pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm")
|
46
|
+
LinuxAdmin::Rpm.should_receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => "1.0"})
|
45
47
|
|
46
48
|
described_class.new.register(base_options)
|
47
49
|
end
|
@@ -49,6 +51,7 @@ describe LinuxAdmin::Rhn do
|
|
49
51
|
it "without server_url" do
|
50
52
|
described_class.any_instance.should_receive(:run!).once.with("rhnreg_ks", run_params)
|
51
53
|
described_class.any_instance.should_not_receive(:install_server_certificate)
|
54
|
+
LinuxAdmin::Rpm.should_receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
|
52
55
|
|
53
56
|
described_class.new.register(base_options)
|
54
57
|
end
|
@@ -56,6 +59,8 @@ describe LinuxAdmin::Rhn do
|
|
56
59
|
|
57
60
|
it "with activation key" do
|
58
61
|
described_class.any_instance.should_receive(:run!).once.with("rhnreg_ks", {:params=>{"--activationkey="=>"123abc", "--proxy="=>"1.2.3.4", "--proxyUser="=>"ProxyUser", "--proxyPassword="=>"ProxyPass"}})
|
62
|
+
LinuxAdmin::Rpm.should_receive(:list_installed).and_return({"rhn-org-trusted-ssl-cert" => nil})
|
63
|
+
|
59
64
|
described_class.new.register(
|
60
65
|
:activationkey => "123abc",
|
61
66
|
:proxy_address => "1.2.3.4",
|