linux_admin 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: f0a9b1d0bd176283e9a4d0611e56c3b891699f6045ba164450cabf12676c3e54
4
- data.tar.gz: 2922af28fd23935d3af3b697a025f02ff36c7651c203a5093057b6a2ce080fdc
2
+ SHA1:
3
+ metadata.gz: bf61e72eb74854665e5ffcd5a3301f8d4adf7b47
4
+ data.tar.gz: '093787d03b9e5e257c1b8a4a51e2f1d5a2808700'
5
5
  SHA512:
6
- metadata.gz: 94bdbfe6c896dc488582134532f5a15a26c86076fb8351efc55b9c5c5617a78ab0cf2bfc6a8154e07df5c9acec44f659b3ade9080b91c8bfe66c50eec3092aa8
7
- data.tar.gz: 7a1453c3a0e04d3d32d7a4ef9c4a585ec66547ed92529e19055947dd077befd6431b3d50edf3c094c3d75741053896b5bef313a484f208d71d708f2da2f6c8c1
6
+ metadata.gz: f9ba05b7aa256903fd6295fd6a69d23643314dd8228e03dbc14bc03b9df145640187705d1672a1c176a47be42f72131f6758a07ed81e664f63bc5794ea297b16
7
+ data.tar.gz: 58105741a7dea22d59daebe727bebcd65bc3737c7dc02339b93968fccd57024ab6cf1a7d975b117686f82e08e651929ba940ab3b93d0dff187377e076d9a4f9b
@@ -6,7 +6,7 @@ module LinuxAdmin
6
6
  module ClassMethods
7
7
  def mount_point_exists?(mount_point)
8
8
  result = Common.run!(Common.cmd(:mount))
9
- result.output.split("\n").any? { |line| line.split[2] == mount_point }
9
+ result.output.split("\n").any? { |line| line.split[2] == mount_point.to_s }
10
10
  end
11
11
 
12
12
  def mount_point_available?(mount_point)
@@ -17,7 +17,7 @@ module LinuxAdmin
17
17
  end
18
18
  end
19
19
 
20
- def registered?(_options = nil)
20
+ def registered?
21
21
  false
22
22
  end
23
23
 
@@ -5,7 +5,7 @@ module LinuxAdmin
5
5
  SATELLITE5_SERVER_CERT_PATH = "pub/rhn-org-trusted-ssl-cert-1.0-1.noarch.rpm"
6
6
  INSTALLED_SERVER_CERT_PATH = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
7
7
 
8
- def registered?(_options = nil)
8
+ def registered?
9
9
  id = ""
10
10
  if File.exist?(systemid_file)
11
11
  xml = Nokogiri.XML(File.read(systemid_file))
@@ -15,10 +15,8 @@ module LinuxAdmin
15
15
  !!organizations(options)
16
16
  end
17
17
 
18
- def registered?(options = nil)
19
- args = ["subscription-manager identity"]
20
- args << {:params => proxy_params(options)} if options
21
- Common.run(*args).exit_status.zero?
18
+ def registered?
19
+ Common.run("subscription-manager identity").exit_status == 0
22
20
  end
23
21
 
24
22
  def refresh
@@ -25,7 +25,7 @@ module LinuxAdmin
25
25
 
26
26
  def execute_commands(commands, agent_socket, stdin)
27
27
  result = nil
28
- args = {:paranoid => false, :number_of_password_prompts => 0}
28
+ args = {:verify_host_key => false, :number_of_password_prompts => 0}
29
29
  if agent_socket
30
30
  args.merge!(:forward_agent => true,
31
31
  :agent_socket_factory => -> { UNIXSocket.open(agent_socket) })
@@ -1,3 +1,3 @@
1
1
  module LinuxAdmin
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.1.0".freeze
3
3
  end
@@ -37,17 +37,33 @@ eos
37
37
  end
38
38
 
39
39
  context "disk mounted at specified location" do
40
- it "returns true" do
40
+ before do
41
41
  expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out1))
42
+ end
43
+
44
+ it "returns true" do
42
45
  expect(TestMountable.mount_point_exists?('/mnt/usb')).to be_truthy
43
46
  end
47
+
48
+ it "returns true when using a pathname" do
49
+ path = Pathname.new("/mnt/usb")
50
+ expect(TestMountable.mount_point_exists?(path)).to be_truthy
51
+ end
44
52
  end
45
53
 
46
54
  context "no disk mounted at specified location" do
47
- it "returns false" do
55
+ before do
48
56
  expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out2))
57
+ end
58
+
59
+ it "returns false" do
49
60
  expect(TestMountable.mount_point_exists?('/mnt/usb')).to be_falsey
50
61
  end
62
+
63
+ it "returns false when using a pathname" do
64
+ path = Pathname.new("/mnt/usb")
65
+ expect(TestMountable.mount_point_exists?(path)).to be_falsey
66
+ end
51
67
  end
52
68
  end
53
69
 
@@ -59,17 +75,33 @@ eos
59
75
  end
60
76
 
61
77
  context "disk mounted at specified location" do
62
- it "returns false" do
78
+ before do
63
79
  expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out1))
80
+ end
81
+
82
+ it "returns false" do
64
83
  expect(TestMountable.mount_point_available?('/mnt/usb')).to be_falsey
65
84
  end
85
+
86
+ it "returns false when using a pathname" do
87
+ path = Pathname.new("/mnt/usb")
88
+ expect(TestMountable.mount_point_available?(path)).to be_falsey
89
+ end
66
90
  end
67
91
 
68
92
  context "no disk mounted at specified location" do
69
- it "returns true" do
93
+ before do
70
94
  expect(LinuxAdmin::Common).to receive(:run!).and_return(double(:output => @mount_out2))
95
+ end
96
+
97
+ it "returns true" do
71
98
  expect(TestMountable.mount_point_available?('/mnt/usb')).to be_truthy
72
99
  end
100
+
101
+ it "returns true when using a pathname" do
102
+ path = Pathname.new("/mnt/usb")
103
+ expect(TestMountable.mount_point_available?(path)).to be_truthy
104
+ end
73
105
  end
74
106
  end
75
107
 
@@ -28,36 +28,9 @@ describe LinuxAdmin::RegistrationSystem do
28
28
  end
29
29
  end
30
30
 
31
- context "#registered?" do
32
- it "when unregistered" do
33
- stub_registered_to_system(nil)
34
- expect(described_class.registered?).to be_falsey
35
- end
36
-
37
- context "SubscriptionManager" do
38
- it "with no args" do
39
- expect(LinuxAdmin::Common).to receive(:run).with("subscription-manager identity").and_return(double(:exit_status => 0))
40
-
41
- LinuxAdmin::SubscriptionManager.new.registered?
42
- end
43
-
44
- it "with a proxy" do
45
- expect(LinuxAdmin::Common).to receive(:run).with(
46
- "subscription-manager identity",
47
- :params => {
48
- "--proxy=" => "https://example.com",
49
- "--proxyuser=" => "user",
50
- "--proxypassword=" => "pass"
51
- }
52
- ).and_return(double(:exit_status => 0))
53
-
54
- LinuxAdmin::SubscriptionManager.new.registered?(
55
- :proxy_address => "https://example.com",
56
- :proxy_username => "user",
57
- :proxy_password => "pass"
58
- )
59
- end
60
- end
31
+ it "#registered? when unregistered" do
32
+ stub_registered_to_system(nil)
33
+ expect(described_class.registered?).to be_falsey
61
34
  end
62
35
 
63
36
  context ".method_missing" do
data/spec/ssh_spec.rb CHANGED
@@ -33,7 +33,7 @@ sV1Tr/acrE0aWBkD9RYrR2/UwG1zfXuIJeufdWf8c0SY3X6J7jJN
33
33
  end
34
34
 
35
35
  it "should create a call using agent" do
36
- expect(Net::SSH).to receive(:start).with("127.0.0.1", "root", :paranoid => false, :forward_agent => true, :number_of_password_prompts => 0, :agent_socket_factory => Proc).and_return(true)
36
+ expect(Net::SSH).to receive(:start).with("127.0.0.1", "root", :verify_host_key => false, :forward_agent => true, :number_of_password_prompts => 0, :agent_socket_factory => Proc).and_return(true)
37
37
  ssh_agent = LinuxAdmin::SSHAgent.new(@example_ssh_key)
38
38
  ssh_agent.with_service do |socket|
39
39
  ssh = LinuxAdmin::SSH.new("127.0.0.1", "root")
@@ -42,12 +42,12 @@ sV1Tr/acrE0aWBkD9RYrR2/UwG1zfXuIJeufdWf8c0SY3X6J7jJN
42
42
  end
43
43
 
44
44
  it "should preform command using private key" do
45
- expect(Net::SSH).to receive(:start).with("127.0.0.1", "root", :paranoid => false, :number_of_password_prompts => 0, :key_data => [@example_ssh_key]).and_return(true)
45
+ expect(Net::SSH).to receive(:start).with("127.0.0.1", "root", :verify_host_key => false, :number_of_password_prompts => 0, :key_data => [@example_ssh_key]).and_return(true)
46
46
  LinuxAdmin::SSH.new("127.0.0.1", "root", @example_ssh_key).perform_commands(%w("ls", "pwd"))
47
47
  end
48
48
 
49
49
  it "should preform command using password" do
50
- expect(Net::SSH).to receive(:start).with("127.0.0.1", "root", :paranoid => false, :number_of_password_prompts => 0, :password => "password").and_return(true)
50
+ expect(Net::SSH).to receive(:start).with("127.0.0.1", "root", :verify_host_key => false, :number_of_password_prompts => 0, :password => "password").and_return(true)
51
51
  LinuxAdmin::SSH.new("127.0.0.1", "root", nil, "password").perform_commands(%w("ls", "pwd"))
52
52
  end
53
53
  end
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: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dunne
@@ -18,10 +18,12 @@ authors:
18
18
  - Šimon Lukašík
19
19
  - Joe VLcek
20
20
  - Bo Yao
21
+ - DuskyPrawn
22
+ - Petr Blaho
21
23
  autorequire:
22
24
  bindir: bin
23
25
  cert_chain: []
24
- date: 2018-01-10 00:00:00.000000000 Z
26
+ date: 2017-10-30 00:00:00.000000000 Z
25
27
  dependencies:
26
28
  - !ruby/object:Gem::Dependency
27
29
  name: bundler
@@ -141,14 +143,20 @@ dependencies:
141
143
  requirements:
142
144
  - - ">="
143
145
  - !ruby/object:Gem::Version
144
- version: 1.6.8
146
+ version: 1.8.1
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: '1.8'
145
150
  type: :runtime
146
151
  prerelease: false
147
152
  version_requirements: !ruby/object:Gem::Requirement
148
153
  requirements:
149
154
  - - ">="
150
155
  - !ruby/object:Gem::Version
151
- version: 1.6.8
156
+ version: 1.8.1
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '1.8'
152
160
  - !ruby/object:Gem::Dependency
153
161
  name: openscap
154
162
  requirement: !ruby/object:Gem::Requirement
@@ -169,21 +177,21 @@ dependencies:
169
177
  requirements:
170
178
  - - "~>"
171
179
  - !ruby/object:Gem::Version
172
- version: 3.2.0
180
+ version: 4.2.0
173
181
  type: :runtime
174
182
  prerelease: false
175
183
  version_requirements: !ruby/object:Gem::Requirement
176
184
  requirements:
177
185
  - - "~>"
178
186
  - !ruby/object:Gem::Version
179
- version: 3.2.0
187
+ version: 4.2.0
180
188
  description: |2
181
189
 
182
190
  LinuxAdmin is a module to simplify management of linux systems.
183
191
  It should be a single place to manage various system level configurations,
184
192
  registration, updates, etc.
185
193
  email:
186
- - brandondunne@hotmail.com
194
+ - bdunne@redhat.com
187
195
  - fryguy9@gmail.com
188
196
  - mmorsi@redhat.com
189
197
  - jrafanie@redhat.com
@@ -197,6 +205,8 @@ email:
197
205
  - isimluk@fedoraproject.org
198
206
  - jvlcek@redhat.com
199
207
  - boyao@redhat.com
208
+ - 32548790+DuskyPrawn@users.noreply.github.com
209
+ - pblaho@redhat.com
200
210
  executables: []
201
211
  extensions: []
202
212
  extra_rdoc_files: []
@@ -310,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
320
  version: '0'
311
321
  requirements: []
312
322
  rubyforge_project:
313
- rubygems_version: 2.7.2
323
+ rubygems_version: 2.6.14
314
324
  signing_key:
315
325
  specification_version: 4
316
326
  summary: LinuxAdmin is a module to simplify management of linux systems.