linux_admin 1.2.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/linux_admin.rb +0 -8
- data/lib/linux_admin/disk.rb +12 -5
- data/lib/linux_admin/registration_system.rb +8 -4
- data/lib/linux_admin/scap.rb +1 -1
- data/lib/linux_admin/service/sys_v_init_service.rb +2 -1
- data/lib/linux_admin/service/systemd_service.rb +6 -2
- data/lib/linux_admin/version.rb +1 -1
- metadata +8 -100
- data/lib/linux_admin/registration_system/rhn.rb +0 -111
- data/spec/chrony_spec.rb +0 -64
- data/spec/common_spec.rb +0 -37
- data/spec/data/rhn/output_rhn-channel_list +0 -2
- data/spec/data/rhn/output_rhn-channel_list_available +0 -4
- data/spec/data/rhn/systemid +0 -57
- data/spec/data/rhn/systemid.missing_system_id +0 -57
- data/spec/data/rpm/cmd_output_for_list_installed +0 -20
- data/spec/data/subscription_manager/output_list_all_available +0 -42
- data/spec/data/subscription_manager/output_list_installed_not_subscribed +0 -19
- data/spec/data/subscription_manager/output_list_installed_subscribed +0 -19
- data/spec/data/subscription_manager/output_orgs +0 -6
- data/spec/data/subscription_manager/output_repos +0 -18
- data/spec/data/time_date/timedatectl_output +0 -14
- data/spec/data/yum/first.repo +0 -19
- data/spec/data/yum/output_repo_list +0 -13
- data/spec/data/yum/output_repoquery_multiple +0 -3
- data/spec/data/yum/output_repoquery_single +0 -1
- data/spec/data/yum/second.repo +0 -9
- data/spec/deb_spec.rb +0 -52
- data/spec/disk_spec.rb +0 -307
- data/spec/distro_spec.rb +0 -77
- data/spec/dns_spec.rb +0 -105
- data/spec/etc_issue_spec.rb +0 -37
- data/spec/fstab_spec.rb +0 -132
- data/spec/hardware_spec.rb +0 -46
- data/spec/hosts_spec.rb +0 -150
- data/spec/ip_address_spec.rb +0 -148
- data/spec/logical_volume_spec.rb +0 -166
- data/spec/mountable_spec.rb +0 -182
- data/spec/network_interface/network_interface_rh_spec.rb +0 -291
- data/spec/network_interface_spec.rb +0 -284
- data/spec/partition_spec.rb +0 -24
- data/spec/physical_volume_spec.rb +0 -101
- data/spec/registration_system_spec.rb +0 -85
- data/spec/rhn_spec.rb +0 -144
- data/spec/rpm_spec.rb +0 -85
- data/spec/scap_spec.rb +0 -48
- data/spec/service/sys_v_init_service_spec.rb +0 -127
- data/spec/service/systemd_service_spec.rb +0 -133
- data/spec/service_spec.rb +0 -54
- data/spec/spec_helper.rb +0 -116
- data/spec/ssh_spec.rb +0 -53
- data/spec/subscription_manager_spec.rb +0 -228
- data/spec/system_spec.rb +0 -15
- data/spec/time_date_spec.rb +0 -106
- data/spec/volume_group_spec.rb +0 -99
- data/spec/yum_spec.rb +0 -155
data/spec/yum_spec.rb
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
describe LinuxAdmin::Yum do
|
2
|
-
before(:each) do
|
3
|
-
allow(FileUtils).to receive_messages(:mkdir_p => true)
|
4
|
-
end
|
5
|
-
|
6
|
-
context ".create_repo" do
|
7
|
-
it "default arguments" do
|
8
|
-
expect(LinuxAdmin::Common).to receive(:run!).once
|
9
|
-
.with("createrepo", :params => {nil => "some/path", "--database" => nil, "--unique-md-filenames" => nil})
|
10
|
-
described_class.create_repo("some/path")
|
11
|
-
end
|
12
|
-
|
13
|
-
it "bare create" do
|
14
|
-
expect(LinuxAdmin::Common).to receive(:run!).once.with("createrepo", :params => {nil => "some/path"})
|
15
|
-
described_class.create_repo("some/path", :database => false, :unique_file_names => false)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context ".download_packages" do
|
20
|
-
it "with valid input" do
|
21
|
-
expect(LinuxAdmin::Common).to receive(:run!).once
|
22
|
-
.with("repotrack", :params => {"-p" => "some/path", nil => "pkg_a pkg_b"})
|
23
|
-
described_class.download_packages("some/path", "pkg_a pkg_b")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "without mirror type" do
|
27
|
-
expect { described_class.download_packages("some/path", "pkg_a pkg_b", :mirror_type => nil) }.to raise_error(ArgumentError)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it ".repo_settings" do
|
32
|
-
expect(described_class).to receive(:parse_repo_dir).once.with("/etc/yum.repos.d").and_return(true)
|
33
|
-
expect(described_class.repo_settings).to be_truthy
|
34
|
-
end
|
35
|
-
|
36
|
-
it ".parse_repo_dir" do
|
37
|
-
expect(described_class.parse_repo_dir(data_file_path("yum"))).to eq({
|
38
|
-
File.join(data_file_path("yum"), "first.repo") =>
|
39
|
-
{ "my-local-repo-a" =>
|
40
|
-
{ "name" =>"My Local Repo A",
|
41
|
-
"baseurl" =>"https://mirror.example.com/a/content/os_ver",
|
42
|
-
"enabled" =>0,
|
43
|
-
"gpgcheck" =>1,
|
44
|
-
"gpgkey" =>"file:///etc/pki/rpm-gpg/RPM-GPG-KEY-my-local-server",
|
45
|
-
"sslverify" =>1,
|
46
|
-
"sslcacert" =>"/etc/rhsm/ca/my-loacl-server.pem",
|
47
|
-
"sslclientkey" =>"/etc/pki/entitlement/0123456789012345678-key.pem",
|
48
|
-
"sslclientcert" =>"/etc/pki/entitlement/0123456789012345678.pem",
|
49
|
-
"metadata_expire" =>86400},
|
50
|
-
"my-local-repo-b" =>
|
51
|
-
{ "name" =>"My Local Repo B",
|
52
|
-
"baseurl" =>"https://mirror.example.com/b/content/os_ver",
|
53
|
-
"enabled" =>1,
|
54
|
-
"gpgcheck" =>0,
|
55
|
-
"sslverify" =>0,
|
56
|
-
"metadata_expire" =>86400}},
|
57
|
-
File.join(data_file_path("yum"), "second.repo") =>
|
58
|
-
{ "my-local-repo-c" =>
|
59
|
-
{ "name" =>"My Local Repo c",
|
60
|
-
"baseurl" =>"https://mirror.example.com/c/content/os_ver",
|
61
|
-
"enabled" =>0,
|
62
|
-
"cost" =>100,
|
63
|
-
"gpgcheck" =>1,
|
64
|
-
"gpgkey" =>"file:///etc/pki/rpm-gpg/RPM-GPG-KEY-my-local-server",
|
65
|
-
"sslverify" =>0,
|
66
|
-
"metadata_expire" =>1}},})
|
67
|
-
end
|
68
|
-
|
69
|
-
context ".updates_available?" do
|
70
|
-
it "check updates for a specific package" do
|
71
|
-
expect(LinuxAdmin::Common).to receive(:run).once.with("yum check-update", :params => {nil => ["abc"]})
|
72
|
-
.and_return(double(:exit_status => 100))
|
73
|
-
expect(described_class.updates_available?("abc")).to be_truthy
|
74
|
-
end
|
75
|
-
|
76
|
-
it "updates are available" do
|
77
|
-
allow(LinuxAdmin::Common).to receive_messages(:run => double(:exit_status => 100))
|
78
|
-
expect(described_class.updates_available?).to be_truthy
|
79
|
-
end
|
80
|
-
|
81
|
-
it "updates not available" do
|
82
|
-
allow(LinuxAdmin::Common).to receive_messages(:run => double(:exit_status => 0))
|
83
|
-
expect(described_class.updates_available?).to be_falsey
|
84
|
-
end
|
85
|
-
|
86
|
-
it "other exit code" do
|
87
|
-
allow(LinuxAdmin::Common).to receive_messages(:run => double(:exit_status => 255, :error => 'test'))
|
88
|
-
expect { described_class.updates_available? }.to raise_error(RuntimeError)
|
89
|
-
end
|
90
|
-
|
91
|
-
it "other error" do
|
92
|
-
allow(LinuxAdmin::Common).to receive(:run).and_raise(RuntimeError)
|
93
|
-
expect { described_class.updates_available? }.to raise_error(RuntimeError)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context ".update" do
|
98
|
-
it "no arguments" do
|
99
|
-
expect(LinuxAdmin::Common).to receive(:run!).once.with("yum -y update", :params => nil)
|
100
|
-
.and_return(AwesomeSpawn::CommandResult.new("", "", "", 0))
|
101
|
-
described_class.update
|
102
|
-
end
|
103
|
-
|
104
|
-
it "with arguments" do
|
105
|
-
expect(LinuxAdmin::Common).to receive(:run!).once.with("yum -y update", :params => {nil => ["1 2", "3"]})
|
106
|
-
.and_return(AwesomeSpawn::CommandResult.new("", "", "", 0))
|
107
|
-
described_class.update("1 2", "3")
|
108
|
-
end
|
109
|
-
|
110
|
-
it "with bad arguments" do
|
111
|
-
error = AwesomeSpawn::CommandResult.new("", "Loaded plugins: product-id\nNo Packages marked for Update\n", "Blah blah ...\nNo Match for argument: \n", 0)
|
112
|
-
expect(LinuxAdmin::Common).to receive(:run!).once
|
113
|
-
.with("yum -y update", :params => {nil => [""]}).and_return(error)
|
114
|
-
expect { described_class.update("") }.to raise_error(AwesomeSpawn::CommandResultError)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
context ".version_available" do
|
119
|
-
it "no packages" do
|
120
|
-
expect { described_class.version_available }.to raise_error(ArgumentError)
|
121
|
-
end
|
122
|
-
|
123
|
-
it "with one package" do
|
124
|
-
expect(LinuxAdmin::Common).to receive(:run!).once
|
125
|
-
.with("repoquery --qf=\"%{name} %{version}\"", :params => {nil => ["subscription-manager"]})
|
126
|
-
.and_return(double(:output => sample_output("yum/output_repoquery_single")))
|
127
|
-
expect(described_class.version_available("subscription-manager")).to eq({"subscription-manager" => "1.1.23.1"})
|
128
|
-
end
|
129
|
-
|
130
|
-
it "with multiple packages" do
|
131
|
-
expect(LinuxAdmin::Common).to receive(:run!).once
|
132
|
-
.with("repoquery --qf=\"%{name} %{version}\"", :params => {nil => ["curl", "subscription-manager", "wget"]})
|
133
|
-
.and_return(double(:output => sample_output("yum/output_repoquery_multiple")))
|
134
|
-
expect(described_class.version_available("curl", "subscription-manager", "wget")).to eq({
|
135
|
-
"curl" => "7.19.7",
|
136
|
-
"subscription-manager" => "1.1.23.1",
|
137
|
-
"wget" => "1.12"
|
138
|
-
})
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
context ".repo_list" do
|
143
|
-
it "with no arguments" do
|
144
|
-
expect(LinuxAdmin::Common).to receive(:run!).with("yum repolist", :params => {nil => "enabled"})
|
145
|
-
.and_return(double(:output => sample_output("yum/output_repo_list")))
|
146
|
-
expect(described_class.repo_list).to eq(["rhel-6-server-rpms", "rhel-ha-for-rhel-6-server-rpms", "rhel-lb-for-rhel-6-server-rpms"])
|
147
|
-
end
|
148
|
-
|
149
|
-
it "with argument" do
|
150
|
-
expect(LinuxAdmin::Common).to receive(:run!).with("yum repolist", :params => {nil => "enabled"})
|
151
|
-
.and_return(double(:output => sample_output("yum/output_repo_list")))
|
152
|
-
expect(described_class.repo_list("enabled")).to eq(["rhel-6-server-rpms", "rhel-ha-for-rhel-6-server-rpms", "rhel-lb-for-rhel-6-server-rpms"])
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|