specinfra 2.36.10 → 2.36.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/specinfra/command/aix/base/inventory.rb +38 -0
- data/lib/specinfra/command/freebsd/base/routing_table.rb +9 -0
- data/lib/specinfra/command/freebsd/base/user.rb +13 -0
- data/lib/specinfra/command/freebsd/v10/package.rb +12 -0
- data/lib/specinfra/command.rb +2 -0
- data/lib/specinfra/version.rb +1 -1
- data/spec/helper/detect_os/aix_spec.rb +58 -0
- data/spec/helper/detect_os/darwin_spec.rb +42 -0
- data/spec/helper/detect_os/freebsd_spec.rb +33 -0
- data/spec/host_inventory/aix/filesystem_spec.rb +107 -0
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11484cf6a0bc89115d5d81e6a9e88c61bba4b786
|
4
|
+
data.tar.gz: e2a17f4a6cfbd342ad18bb8c924ae26d103e2c53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f14946783c3c1a97c2c91f83b243df0a47cdac3c4b37eacfe2832d257862cace1eec5b873d1b1bb249665ecdf4aa94a5e603ac3a66e185a5a2473abc5769b29f
|
7
|
+
data.tar.gz: 89730d04185b7469d274c61c9ebc770ceae447cfb7e904f815ce28a723ea37073f47bac36e9fcbac93c5679b7507642d232668bb6460c867cb242baa9389856b
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Specinfra::Command::Aix::Base::Inventory < Specinfra::Command::Base::Inventory
|
2
|
+
class << self
|
3
|
+
def get_memory
|
4
|
+
'false'
|
5
|
+
end
|
6
|
+
|
7
|
+
def get_cpu
|
8
|
+
'false'
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_hostname
|
12
|
+
'uname -n'
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_domain
|
16
|
+
# This is emulating the dnsdomainname command in Linux
|
17
|
+
# Requires proper configuration of /etc/resolv.conf
|
18
|
+
# and DNS.
|
19
|
+
# The exit at the end is to only return one entry if
|
20
|
+
# the host is running in dualstack mode (IPv4 and IPv6)
|
21
|
+
'host -n `uname -n` | ' +
|
22
|
+
'awk -v h=`uname -n` \'$1 ~ h { sub(h".", "", $1); print $1; exit }\''
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_fqdn
|
26
|
+
# This is emulating the hostname -f command in Linux
|
27
|
+
# Requires proper configuration of /etc/resolv.conf
|
28
|
+
# and DNS.
|
29
|
+
# The exit at the end is to only return one entry if
|
30
|
+
# the host is running in dualstack mode (IPv4 and IPv6)
|
31
|
+
'host -n `uname -n` | awk -v h=`uname -n` \'$1 ~ h"." { print $1; exit }\''
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_filesystem
|
35
|
+
'df -kP'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Specinfra::Command::Freebsd::Base::RoutingTable < Specinfra::Command::Base::RoutingTable
|
2
|
+
class << self
|
3
|
+
def check_has_entry(destination)
|
4
|
+
%Q{netstat -rnW | grep #{destination} | awk '{print $1, "via", $2, "dev", $7, " "}'}
|
5
|
+
end
|
6
|
+
|
7
|
+
alias :get_entry :check_has_entry
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Specinfra::Command::Freebsd::Base::User < Specinfra::Command::Base::User
|
2
|
+
class << self
|
3
|
+
|
4
|
+
def get_minimum_days_between_password_change(user)
|
5
|
+
"0"
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_maximum_days_between_password_change(user)
|
9
|
+
"pw usershow -n #{escape(user)} | cut -d':' -f 6"
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -8,6 +8,18 @@ class Specinfra::Command::Freebsd::V10::Package < Specinfra::Command::Freebsd::B
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
alias :check_is_installed_by_pkg :check_is_installed
|
12
|
+
|
13
|
+
def check_is_installed_by_rpm(package, version=nil)
|
14
|
+
cmd = "rpm -q #{escape(package)}"
|
15
|
+
if version
|
16
|
+
cmd = "#{cmd} | grep -w -- #{escape(package)}-#{escape(version)}"
|
17
|
+
end
|
18
|
+
cmd
|
19
|
+
end
|
20
|
+
|
21
|
+
alias :check_is_installed_by_yum :check_is_installed_by_rpm
|
22
|
+
|
11
23
|
def install(package, version=nil, option='')
|
12
24
|
"pkg install -y #{option} #{package}"
|
13
25
|
end
|
data/lib/specinfra/command.rb
CHANGED
@@ -110,6 +110,7 @@ require 'specinfra/command/aix/base'
|
|
110
110
|
require 'specinfra/command/aix/base/file'
|
111
111
|
require 'specinfra/command/aix/base/group'
|
112
112
|
require 'specinfra/command/aix/base/host'
|
113
|
+
require 'specinfra/command/aix/base/inventory'
|
113
114
|
require 'specinfra/command/aix/base/package'
|
114
115
|
require 'specinfra/command/aix/base/port'
|
115
116
|
require 'specinfra/command/aix/base/service'
|
@@ -208,6 +209,7 @@ require 'specinfra/command/freebsd/base/inventory'
|
|
208
209
|
require 'specinfra/command/freebsd/base/package'
|
209
210
|
require 'specinfra/command/freebsd/base/port'
|
210
211
|
require 'specinfra/command/freebsd/base/service'
|
212
|
+
require 'specinfra/command/freebsd/base/routing_table'
|
211
213
|
|
212
214
|
# FreeBSD V10 (inherit FreeBSD)
|
213
215
|
require 'specinfra/command/freebsd/v10'
|
data/lib/specinfra/version.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'specinfra/helper/detect_os/aix'
|
3
|
+
|
4
|
+
describe Specinfra::Helper::DetectOs::Aix do
|
5
|
+
aix = Specinfra::Helper::DetectOs::Aix.new(:exec)
|
6
|
+
it 'Should return aix 10.11 powerpc when (fictional) AIX 10.11 is installed.' do
|
7
|
+
allow(aix).to receive(:run_command).with('uname -s') {
|
8
|
+
CommandResult.new(:stdout => 'AIX', :exit_status => 0)
|
9
|
+
}
|
10
|
+
allow(aix).to receive(:run_command).with('uname -rvp') {
|
11
|
+
CommandResult.new(:stdout => '11 10 powerpc', :exit_status => 0)
|
12
|
+
}
|
13
|
+
expect(aix.detect).to include(
|
14
|
+
:family => 'aix',
|
15
|
+
:release => '10.11',
|
16
|
+
:arch => 'powerpc'
|
17
|
+
)
|
18
|
+
end
|
19
|
+
it 'Should return aix 7.1 powerpc when AIX 7.1 is installed.' do
|
20
|
+
allow(aix).to receive(:run_command).with('uname -s') {
|
21
|
+
CommandResult.new(:stdout => 'AIX', :exit_status => 0)
|
22
|
+
}
|
23
|
+
allow(aix).to receive(:run_command).with('uname -rvp') {
|
24
|
+
CommandResult.new(:stdout => '1 7 powerpc', :exit_status => 0)
|
25
|
+
}
|
26
|
+
expect(aix.detect).to include(
|
27
|
+
:family => 'aix',
|
28
|
+
:release => '7.1',
|
29
|
+
:arch => 'powerpc'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
it 'Should return aix 6.1 powerpc when AIX 6.1 is installed.' do
|
33
|
+
allow(aix).to receive(:run_command).with('uname -s') {
|
34
|
+
CommandResult.new(:stdout => 'AIX', :exit_status => 0)
|
35
|
+
}
|
36
|
+
allow(aix).to receive(:run_command).with('uname -rvp') {
|
37
|
+
CommandResult.new(:stdout => '1 6 powerpc', :exit_status => 0)
|
38
|
+
}
|
39
|
+
expect(aix.detect).to include(
|
40
|
+
:family => 'aix',
|
41
|
+
:release => '6.1',
|
42
|
+
:arch => 'powerpc'
|
43
|
+
)
|
44
|
+
end
|
45
|
+
it 'Should return aix when AIX is installed.' do
|
46
|
+
allow(aix).to receive(:run_command).with('uname -s') {
|
47
|
+
CommandResult.new(:stdout => 'AIX', :exit_status => 0)
|
48
|
+
}
|
49
|
+
allow(aix).to receive(:run_command).with('uname -rvp') {
|
50
|
+
CommandResult.new(:stdout => '', :exit_status => 1)
|
51
|
+
}
|
52
|
+
expect(aix.detect).to include(
|
53
|
+
:family => 'aix',
|
54
|
+
:release => nil,
|
55
|
+
:arch => nil
|
56
|
+
)
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'specinfra/helper/detect_os/darwin'
|
3
|
+
|
4
|
+
describe Specinfra::Helper::DetectOs::Darwin do
|
5
|
+
darwin = Specinfra::Helper::DetectOs::Darwin.new(:exec)
|
6
|
+
it 'Should return darwin 13.4.0 when Mac OS X 10.9.5 (Mavericks) is installed.' do
|
7
|
+
allow(darwin).to receive(:run_command).with('uname -s') {
|
8
|
+
CommandResult.new(:stdout => 'Darwin', :exit_status => 0)
|
9
|
+
}
|
10
|
+
allow(darwin).to receive(:run_command).with('uname -r') {
|
11
|
+
CommandResult.new(:stdout => '13.4.0', :exit_status => 0)
|
12
|
+
}
|
13
|
+
expect(darwin.detect).to include(
|
14
|
+
:family => 'darwin',
|
15
|
+
:release => '13.4.0'
|
16
|
+
)
|
17
|
+
end
|
18
|
+
it 'Should return darwin 12.6.0 when Mac OS X 10.8.5 (Mountain Lion) is installed.' do
|
19
|
+
allow(darwin).to receive(:run_command).with('uname -s') {
|
20
|
+
CommandResult.new(:stdout => 'Darwin', :exit_status => 0)
|
21
|
+
}
|
22
|
+
allow(darwin).to receive(:run_command).with('uname -r') {
|
23
|
+
CommandResult.new(:stdout => '12.6.0', :exit_status => 0)
|
24
|
+
}
|
25
|
+
expect(darwin.detect).to include(
|
26
|
+
:family => 'darwin',
|
27
|
+
:release => '12.6.0'
|
28
|
+
)
|
29
|
+
end
|
30
|
+
it 'Should return darwin 11.4.2 when Mac OS X 10.7.5 (Lion) is installed.' do
|
31
|
+
allow(darwin).to receive(:run_command).with('uname -s') {
|
32
|
+
CommandResult.new(:stdout => 'Darwin', :exit_status => 0)
|
33
|
+
}
|
34
|
+
allow(darwin).to receive(:run_command).with('uname -r') {
|
35
|
+
CommandResult.new(:stdout => '11.4.2', :exit_status => 0)
|
36
|
+
}
|
37
|
+
expect(darwin.detect).to include(
|
38
|
+
:family => 'darwin',
|
39
|
+
:release => '11.4.2'
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'specinfra/helper/detect_os/freebsd'
|
3
|
+
|
4
|
+
describe Specinfra::Helper::DetectOs::Freebsd do
|
5
|
+
freebsd = Specinfra::Helper::DetectOs::Freebsd.new(:exec)
|
6
|
+
it 'Should return freebsd 8 when FreeBSD 8.2-RELEASE-p3 is installed.' do
|
7
|
+
allow(freebsd).to receive(:run_command) {
|
8
|
+
CommandResult.new(:stdout => 'FreeBSD 8.2-RELEASE-p3', :exit_status => 0)
|
9
|
+
}
|
10
|
+
expect(freebsd.detect).to include(
|
11
|
+
:family => 'freebsd',
|
12
|
+
:release => '8'
|
13
|
+
)
|
14
|
+
end
|
15
|
+
it 'Should return freebsd 9 when FreeBSD 9.3-RELEASE is installed.' do
|
16
|
+
allow(freebsd).to receive(:run_command) {
|
17
|
+
CommandResult.new(:stdout => 'FreeBSD 9.3-RELEASE', :exit_status => 0)
|
18
|
+
}
|
19
|
+
expect(freebsd.detect).to include(
|
20
|
+
:family => 'freebsd',
|
21
|
+
:release => '9'
|
22
|
+
)
|
23
|
+
end
|
24
|
+
it 'Should return freebsd 10 when FreeBSD 10.1-RELEASE is installed.' do
|
25
|
+
allow(freebsd).to receive(:run_command) {
|
26
|
+
CommandResult.new(:stdout => 'FreeBSD 10.1--RELEASE', :exit_status => 0)
|
27
|
+
}
|
28
|
+
expect(freebsd.detect).to include(
|
29
|
+
:family => 'freebsd',
|
30
|
+
:release => '10'
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Output from 'df -kP'
|
4
|
+
str = <<-EOH
|
5
|
+
Filesystem 1024-blocks Used Available Capacity Mounted on
|
6
|
+
/dev/hd4 524288 67328 456960 13% /
|
7
|
+
/dev/hd2 4194304 3077768 1116536 74% /usr
|
8
|
+
/dev/hd9var 3145728 96588 3049140 4% /var
|
9
|
+
/dev/hd3 2097152 128588 1968564 7% /tmp
|
10
|
+
/dev/hd1 65536 380 65156 1% /home
|
11
|
+
/dev/hd11admin 131072 364 130708 1% /admin
|
12
|
+
/proc - - - - /proc
|
13
|
+
/dev/hd10opt 4194304 725280 3469024 18% /opt
|
14
|
+
/dev/livedump 1572864 568 1572296 1% /var/adm/ras/livedump
|
15
|
+
/dev/fslv00 1048576 127848 920728 13% /audit
|
16
|
+
EOH
|
17
|
+
|
18
|
+
describe Specinfra::HostInventory::Filesystem do
|
19
|
+
let(:host_inventory) { nil }
|
20
|
+
describe 'Example of AIX 7.1' do
|
21
|
+
ret = Specinfra::HostInventory::Filesystem.new(host_inventory).parse(str)
|
22
|
+
example "/dev/fslv00" do
|
23
|
+
expect(ret["/dev/fslv00"]).to include(
|
24
|
+
"kb_available" => "920728",
|
25
|
+
"kb_size" => "1048576",
|
26
|
+
"kb_used" => "127848",
|
27
|
+
"mount" => "/audit",
|
28
|
+
"percent_used" => "13%"
|
29
|
+
)
|
30
|
+
end
|
31
|
+
example "/dev/hd1" do
|
32
|
+
expect(ret["/dev/hd1"]).to include(
|
33
|
+
"kb_available" => "65156",
|
34
|
+
"kb_size" => "65536",
|
35
|
+
"kb_used" => "380",
|
36
|
+
"mount" => "/home",
|
37
|
+
"percent_used" => "1%"
|
38
|
+
)
|
39
|
+
end
|
40
|
+
example "/dev/hd2" do
|
41
|
+
expect(ret["/dev/hd2"]).to include(
|
42
|
+
"kb_available" => "1116536",
|
43
|
+
"kb_used" => "3077768",
|
44
|
+
"kb_size" => "4194304",
|
45
|
+
"mount" => "/usr",
|
46
|
+
"percent_used" => "74%"
|
47
|
+
)
|
48
|
+
end
|
49
|
+
example "/dev/hd3" do
|
50
|
+
expect(ret["/dev/hd3"]).to include(
|
51
|
+
"kb_available" => "1968564",
|
52
|
+
"kb_size" => "2097152",
|
53
|
+
"kb_used" => "128588",
|
54
|
+
"mount" => "/tmp",
|
55
|
+
"percent_used" => "7%"
|
56
|
+
)
|
57
|
+
end
|
58
|
+
example "/dev/hd4" do
|
59
|
+
expect(ret["/dev/hd4"]).to include(
|
60
|
+
"kb_available" => "456960",
|
61
|
+
"kb_size" => "524288",
|
62
|
+
"kb_used" => "67328",
|
63
|
+
"mount" => "/",
|
64
|
+
"percent_used" => "13%"
|
65
|
+
)
|
66
|
+
end
|
67
|
+
example "/dev/hd9var" do
|
68
|
+
expect(ret["/dev/hd9var"]).to include(
|
69
|
+
"kb_available" => "3049140",
|
70
|
+
"kb_size" => "3145728",
|
71
|
+
"kb_used" => "96588",
|
72
|
+
"mount" => "/var",
|
73
|
+
"percent_used" => "4%"
|
74
|
+
)
|
75
|
+
end
|
76
|
+
example "/dev/hd10opt" do
|
77
|
+
expect(ret["/dev/hd10opt"]).to include(
|
78
|
+
"kb_available" => "3469024",
|
79
|
+
"kb_size" => "4194304",
|
80
|
+
"kb_used" => "725280",
|
81
|
+
"mount" => "/opt",
|
82
|
+
"percent_used" => "18%"
|
83
|
+
)
|
84
|
+
end
|
85
|
+
example "/dev/hd11admin" do
|
86
|
+
expect(ret["/dev/hd11admin"]).to include(
|
87
|
+
"kb_available" => "130708",
|
88
|
+
"kb_used" => "364",
|
89
|
+
"kb_size" => "131072",
|
90
|
+
"mount" => "/admin",
|
91
|
+
"percent_used" => "1%"
|
92
|
+
)
|
93
|
+
end
|
94
|
+
example "/dev/livedump" do
|
95
|
+
expect(ret["/dev/livedump"]).to include(
|
96
|
+
"kb_available" => "1572296",
|
97
|
+
"kb_size" => "1572864",
|
98
|
+
"kb_used" => "568",
|
99
|
+
"mount" => "/var/adm/ras/livedump",
|
100
|
+
"percent_used" => "1%"
|
101
|
+
)
|
102
|
+
end
|
103
|
+
example "/proc" do
|
104
|
+
expect(ret).to_not include( "/proc" )
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.36.
|
4
|
+
version: 2.36.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- lib/specinfra/command/aix/base/file.rb
|
159
159
|
- lib/specinfra/command/aix/base/group.rb
|
160
160
|
- lib/specinfra/command/aix/base/host.rb
|
161
|
+
- lib/specinfra/command/aix/base/inventory.rb
|
161
162
|
- lib/specinfra/command/aix/base/package.rb
|
162
163
|
- lib/specinfra/command/aix/base/port.rb
|
163
164
|
- lib/specinfra/command/aix/base/service.rb
|
@@ -239,7 +240,9 @@ files:
|
|
239
240
|
- lib/specinfra/command/freebsd/base/inventory.rb
|
240
241
|
- lib/specinfra/command/freebsd/base/package.rb
|
241
242
|
- lib/specinfra/command/freebsd/base/port.rb
|
243
|
+
- lib/specinfra/command/freebsd/base/routing_table.rb
|
242
244
|
- lib/specinfra/command/freebsd/base/service.rb
|
245
|
+
- lib/specinfra/command/freebsd/base/user.rb
|
243
246
|
- lib/specinfra/command/freebsd/v10.rb
|
244
247
|
- lib/specinfra/command/freebsd/v10/package.rb
|
245
248
|
- lib/specinfra/command/gentoo.rb
|
@@ -449,10 +452,14 @@ files:
|
|
449
452
|
- spec/command/ubuntu/ppa_spec.rb
|
450
453
|
- spec/command/windows/registry_key_spec.rb
|
451
454
|
- spec/configuration_spec.rb
|
455
|
+
- spec/helper/detect_os/aix_spec.rb
|
456
|
+
- spec/helper/detect_os/darwin_spec.rb
|
452
457
|
- spec/helper/detect_os/esxi_spec.rb
|
458
|
+
- spec/helper/detect_os/freebsd_spec.rb
|
453
459
|
- spec/helper/os_spec.rb
|
454
460
|
- spec/helper/properties_spec.rb
|
455
461
|
- spec/helper/set_spec.rb
|
462
|
+
- spec/host_inventory/aix/filesystem_spec.rb
|
456
463
|
- spec/host_inventory/darwin/filesystem_spec.rb
|
457
464
|
- spec/host_inventory/freebsd/filesystem_spec.rb
|
458
465
|
- spec/host_inventory/linux/cpu_spec.rb
|
@@ -523,14 +530,17 @@ test_files:
|
|
523
530
|
- spec/command/ubuntu/ppa_spec.rb
|
524
531
|
- spec/command/windows/registry_key_spec.rb
|
525
532
|
- spec/configuration_spec.rb
|
533
|
+
- spec/helper/detect_os/aix_spec.rb
|
534
|
+
- spec/helper/detect_os/darwin_spec.rb
|
526
535
|
- spec/helper/detect_os/esxi_spec.rb
|
536
|
+
- spec/helper/detect_os/freebsd_spec.rb
|
527
537
|
- spec/helper/os_spec.rb
|
528
538
|
- spec/helper/properties_spec.rb
|
529
539
|
- spec/helper/set_spec.rb
|
540
|
+
- spec/host_inventory/aix/filesystem_spec.rb
|
530
541
|
- spec/host_inventory/darwin/filesystem_spec.rb
|
531
542
|
- spec/host_inventory/freebsd/filesystem_spec.rb
|
532
543
|
- spec/host_inventory/linux/cpu_spec.rb
|
533
544
|
- spec/host_inventory/linux/filesystem_spec.rb
|
534
545
|
- spec/host_inventory/linux/memory_spec.rb
|
535
546
|
- spec/spec_helper.rb
|
536
|
-
has_rdoc:
|