linux_admin 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/linux_admin/distro.rb +5 -1
- data/lib/linux_admin/homebrew.rb +21 -0
- data/lib/linux_admin/network_interface/network_interface_darwin.rb +19 -0
- data/lib/linux_admin/network_interface.rb +4 -1
- data/lib/linux_admin/version.rb +1 -1
- data/lib/linux_admin.rb +1 -0
- metadata +20 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de3cd5883d8dee83ce8db19f61bb2b6b47cf8a057a00f37488ce809110d8d158
|
|
4
|
+
data.tar.gz: f6bc420d4a091ce5cb42150e8ec7d2b6fe149c38b3a9c0bf6981ee76ff582302
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21a1d96a14181e0bd6d0c74d654f3588dab524d5a2ab0a0adda21e88b134e013be8e78927e5e912be729071459c6ac1cb72add42ae328e499e2ab92a8223078d
|
|
7
|
+
data.tar.gz: 78fb390e5faf124d4dd27e001464854cbcafcf0346bb9eaebd5a98591257bae9ac8b00a0d34dec0ebcb05979553bb973f672f0d4061095090d7e75960ffec977
|
data/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/linux_admin)
|
|
4
4
|
[](https://github.com/ManageIQ/linux_admin/actions/workflows/ci.yaml)
|
|
5
|
-
[](https://codeclimate.com/github/ManageIQ/linux_admin)
|
|
6
|
-
[](https://codeclimate.com/github/ManageIQ/linux_admin/coverage)
|
|
7
5
|
|
|
8
6
|
LinuxAdmin is a module to simplify management of linux systems.
|
|
9
7
|
It should be a single place to manage various system level configurations,
|
data/lib/linux_admin/distro.rb
CHANGED
|
@@ -18,8 +18,12 @@ module LinuxAdmin
|
|
|
18
18
|
@ubuntu ||= Distro.new(:ubuntu, nil, ['ubuntu'], LinuxAdmin::Deb)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def self.darwin
|
|
22
|
+
@darwin ||= Distro.new(:darwin, "/System/Library/CoreServices/SystemVersion.plist", ['darwin'], LinuxAdmin::Homebrew)
|
|
23
|
+
end
|
|
24
|
+
|
|
21
25
|
def self.all
|
|
22
|
-
@distros ||= [rhel, fedora, ubuntu, generic]
|
|
26
|
+
@distros ||= [rhel, fedora, ubuntu, darwin, generic]
|
|
23
27
|
end
|
|
24
28
|
|
|
25
29
|
def self.local
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module LinuxAdmin
|
|
2
|
+
class Homebrew < Package
|
|
3
|
+
extend Logging
|
|
4
|
+
|
|
5
|
+
def self.homebrew_cmd
|
|
6
|
+
Common.cmd("brew")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.list_installed
|
|
10
|
+
info(nil)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.info(pkg)
|
|
14
|
+
out = Common.run!(homebrew_cmd, :params => ["list", :versions, pkg]).output
|
|
15
|
+
out.split("\n").each_with_object({}) do |line, pkg_hash|
|
|
16
|
+
name, ver = line.split[0..1] # only take the latest version
|
|
17
|
+
pkg_hash[name] = ver
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module LinuxAdmin
|
|
2
|
+
class NetworkInterfaceDarwin < NetworkInterface
|
|
3
|
+
# Runs the command `ip -[4/6] route` and returns the output
|
|
4
|
+
#
|
|
5
|
+
# @param version [Fixnum] Version of IP protocol (4 or 6)
|
|
6
|
+
# @return [String] The command output
|
|
7
|
+
# @raise [NetworkInterfaceError] if the command fails
|
|
8
|
+
#
|
|
9
|
+
# macs use ip route get while others use ip route show
|
|
10
|
+
def ip_route(version, route = "default")
|
|
11
|
+
output = Common.run!(Common.cmd("ip"), :params => ["--json", "-#{version}", "route", "get", route]).output
|
|
12
|
+
return {} if output.blank?
|
|
13
|
+
|
|
14
|
+
JSON.parse(output).first
|
|
15
|
+
rescue AwesomeSpawn::CommandResultError => e
|
|
16
|
+
raise NetworkInterfaceError.new(e.message, e.result)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -13,8 +13,11 @@ module LinuxAdmin
|
|
|
13
13
|
def self.dist_class(clear_cache = false)
|
|
14
14
|
@dist_class = nil if clear_cache
|
|
15
15
|
@dist_class ||= begin
|
|
16
|
-
|
|
16
|
+
case Distros.local
|
|
17
|
+
when Distros.rhel, Distros.fedora
|
|
17
18
|
NetworkInterfaceRH
|
|
19
|
+
when Distros.darwin
|
|
20
|
+
NetworkInterfaceDarwin
|
|
18
21
|
else
|
|
19
22
|
NetworkInterfaceGeneric
|
|
20
23
|
end
|
data/lib/linux_admin/version.rb
CHANGED
data/lib/linux_admin.rb
CHANGED
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: 4.
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brandon Dunne
|
|
@@ -27,10 +27,9 @@ authors:
|
|
|
27
27
|
- whitesource-bolt-for-github[bot]
|
|
28
28
|
- Adam Grare
|
|
29
29
|
- renovate[bot]
|
|
30
|
-
autorequire:
|
|
31
30
|
bindir: bin
|
|
32
31
|
cert_chain: []
|
|
33
|
-
date:
|
|
32
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
34
33
|
dependencies:
|
|
35
34
|
- !ruby/object:Gem::Dependency
|
|
36
35
|
name: manageiq-style
|
|
@@ -162,19 +161,28 @@ dependencies:
|
|
|
162
161
|
requirements:
|
|
163
162
|
- - "~>"
|
|
164
163
|
- !ruby/object:Gem::Version
|
|
165
|
-
version: '4.
|
|
164
|
+
version: '4.5'
|
|
165
|
+
- - ">="
|
|
166
|
+
- !ruby/object:Gem::Version
|
|
167
|
+
version: 4.5.1
|
|
166
168
|
type: :runtime
|
|
167
169
|
prerelease: false
|
|
168
170
|
version_requirements: !ruby/object:Gem::Requirement
|
|
169
171
|
requirements:
|
|
170
172
|
- - "~>"
|
|
171
173
|
- !ruby/object:Gem::Version
|
|
172
|
-
version: '4.
|
|
174
|
+
version: '4.5'
|
|
175
|
+
- - ">="
|
|
176
|
+
- !ruby/object:Gem::Version
|
|
177
|
+
version: 4.5.1
|
|
173
178
|
- !ruby/object:Gem::Dependency
|
|
174
179
|
name: net-ssh
|
|
175
180
|
requirement: !ruby/object:Gem::Requirement
|
|
176
181
|
requirements:
|
|
177
182
|
- - "~>"
|
|
183
|
+
- !ruby/object:Gem::Version
|
|
184
|
+
version: '7.2'
|
|
185
|
+
- - ">="
|
|
178
186
|
- !ruby/object:Gem::Version
|
|
179
187
|
version: 7.2.3
|
|
180
188
|
type: :runtime
|
|
@@ -182,6 +190,9 @@ dependencies:
|
|
|
182
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
183
191
|
requirements:
|
|
184
192
|
- - "~>"
|
|
193
|
+
- !ruby/object:Gem::Version
|
|
194
|
+
version: '7.2'
|
|
195
|
+
- - ">="
|
|
185
196
|
- !ruby/object:Gem::Version
|
|
186
197
|
version: 7.2.3
|
|
187
198
|
- !ruby/object:Gem::Dependency
|
|
@@ -296,12 +307,14 @@ files:
|
|
|
296
307
|
- lib/linux_admin/exceptions.rb
|
|
297
308
|
- lib/linux_admin/fstab.rb
|
|
298
309
|
- lib/linux_admin/hardware.rb
|
|
310
|
+
- lib/linux_admin/homebrew.rb
|
|
299
311
|
- lib/linux_admin/hosts.rb
|
|
300
312
|
- lib/linux_admin/ip_address.rb
|
|
301
313
|
- lib/linux_admin/logging.rb
|
|
302
314
|
- lib/linux_admin/logical_volume.rb
|
|
303
315
|
- lib/linux_admin/mountable.rb
|
|
304
316
|
- lib/linux_admin/network_interface.rb
|
|
317
|
+
- lib/linux_admin/network_interface/network_interface_darwin.rb
|
|
305
318
|
- lib/linux_admin/network_interface/network_interface_generic.rb
|
|
306
319
|
- lib/linux_admin/network_interface/network_interface_rh.rb
|
|
307
320
|
- lib/linux_admin/null_logger.rb
|
|
@@ -328,7 +341,6 @@ homepage: http://github.com/ManageIQ/linux_admin
|
|
|
328
341
|
licenses:
|
|
329
342
|
- MIT
|
|
330
343
|
metadata: {}
|
|
331
|
-
post_install_message:
|
|
332
344
|
rdoc_options: []
|
|
333
345
|
require_paths:
|
|
334
346
|
- lib
|
|
@@ -336,15 +348,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
336
348
|
requirements:
|
|
337
349
|
- - ">="
|
|
338
350
|
- !ruby/object:Gem::Version
|
|
339
|
-
version: '
|
|
351
|
+
version: '3.0'
|
|
340
352
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
353
|
requirements:
|
|
342
354
|
- - ">="
|
|
343
355
|
- !ruby/object:Gem::Version
|
|
344
356
|
version: '0'
|
|
345
357
|
requirements: []
|
|
346
|
-
rubygems_version: 3.
|
|
347
|
-
signing_key:
|
|
358
|
+
rubygems_version: 3.6.9
|
|
348
359
|
specification_version: 4
|
|
349
360
|
summary: LinuxAdmin is a module to simplify management of linux systems.
|
|
350
361
|
test_files: []
|