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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzkxZDkxZDkxMDNiNzlkMTkxNDY2MDExZDVlNzgwZGU3YTMyNDhkOQ==
4
+ NzNkYTcwOThkNWI2YzgwODM1M2E3NmIyODA0YjUyMTFmODM1ZWYyZg==
5
5
  data.tar.gz: !binary |-
6
- NzQyODliMjBlMzMwMzY0NGM2YmI5YjdhYWYyYzNmMjgwNzJjYTExNg==
6
+ NDIwMWRiNWQyYjUzNDUwMjRkMzZmZDc1Zjc1YjM2ZDgzZmVkNDg5NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjZhZjg4NjczY2I3NGIxNjExNTI0Y2EwZDY5ZjNiMjE0ODcxZmU3NzkwM2Nj
10
- NWMyMWI0NTAxNzA4N2FmNmJmNmM2NmFmMWJhNTgzODVlOGRjMzk0MDNhZDhi
11
- YmE4ZDk5ZTNlZTgwMDI3OGM2MmQ4ZjBjOWYxODRkZDUwMzAzYTg=
9
+ NTNiMTg1NTM2YWM4MTczMDgyOTBkMWU0OWVhMTI2MDYzNzJkNWY0NmVjMWZk
10
+ ZGVkNTgyODkzYzVjNGUzNzAwZDhhMzdmMjAyODg1YjYzMzNlMmYxZWEyODM5
11
+ ZGQ4MjY1YmE1YWRhZDY3NDdmOTMxMjM4N2IxYzU4NmU1ZjMyZDc=
12
12
  data.tar.gz: !binary |-
13
- MGVkMmEzNjAxNTQ4ZTZmZTQ1YjVjMDMxMjZmYzI2NDA4N2RiMDllYzdlZmU5
14
- MzI3YzU3MTQ0ZWQ0ZWVjZDEwY2I0NDQ3Y2IyOGM3NTk5MjhlYWRhZmJkMmY3
15
- MDFjODIzMzJlODA4OTg1MDI3MGIyZjY4ZmI4NmFmMDljNTg5NGE=
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] if options[:proxy_address]
32
- params["--proxyUser="] = options[:proxy_username] if options[:proxy_username]
33
- params["--proxyPassword="] = options[:proxy_password] if options[:proxy_password]
34
- params["--serverUrl="] = options[:server_url] if options[:server_url]
35
- params["--systemorgid="] = options[:org] if options[:server_url] && options[:org]
36
- params["--sslCACert="] = options[:server_cert] if options[:server_cert]
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
@@ -1,3 +1,3 @@
1
1
  class LinuxAdmin
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
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", "--sslCACert="=>"/path/to/cert"}} }
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",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linux_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dunne