specinfra 2.0.0.beta50 → 2.0.0.beta51
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/specinfra/backend/powershell/support/find_iis_component.ps1 +14 -4
- data/lib/specinfra/command.rb +2 -1
- data/lib/specinfra/command/arch/base/package.rb +3 -2
- data/lib/specinfra/command/base/inventory.rb +2 -0
- data/lib/specinfra/command/linux/base/inventory.rb +7 -0
- data/lib/specinfra/helper.rb +3 -0
- data/lib/specinfra/helper/host_inventory.rb +12 -0
- data/lib/specinfra/host_inventory.rb +18 -0
- data/lib/specinfra/processor.rb +28 -22
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/linux/inventory_spec.rb +7 -0
- metadata +126 -93
- checksums.yaml +0 -7
- data/lib/specinfra/command/openbsd/base/routing_table.rb +0 -9
@@ -17,8 +17,14 @@ function FindIISAppPool
|
|
17
17
|
param($name)
|
18
18
|
|
19
19
|
Import-Module WebAdministration
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
Try {
|
22
|
+
Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue
|
23
|
+
}
|
24
|
+
Catch [System.IO.FileNotFoundException] {
|
25
|
+
Get-Item "IIS:\AppPools\$name" -Erroraction silentlycontinue
|
26
|
+
|
27
|
+
}
|
22
28
|
}
|
23
29
|
|
24
30
|
function FindSiteBindings
|
@@ -26,8 +32,12 @@ function FindSiteBindings
|
|
26
32
|
param($name, $protocol, $hostHeader, $port, $ipAddress)
|
27
33
|
|
28
34
|
Import-Module WebAdministration
|
29
|
-
|
30
|
-
|
35
|
+
Try {
|
36
|
+
Get-WebBinding -Name $name -Protocol $protocol -HostHeader $hostHeader -Port $port -IPAddress $ipAddress
|
37
|
+
}
|
38
|
+
Catch [System.IO.FileNotFoundException] {
|
39
|
+
Get-WebBinding -Name $name -Protocol $protocol -HostHeader $hostHeader -Port $port -IPAddress $ipAddress
|
40
|
+
}
|
31
41
|
}
|
32
42
|
|
33
43
|
function FindSiteVirtualDir
|
data/lib/specinfra/command.rb
CHANGED
@@ -12,6 +12,7 @@ require 'specinfra/command/base/file'
|
|
12
12
|
require 'specinfra/command/base/group'
|
13
13
|
require 'specinfra/command/base/host'
|
14
14
|
require 'specinfra/command/base/interface'
|
15
|
+
require 'specinfra/command/base/inventory'
|
15
16
|
require 'specinfra/command/base/ipfilter'
|
16
17
|
require 'specinfra/command/base/ipnat'
|
17
18
|
require 'specinfra/command/base/iptables'
|
@@ -36,6 +37,7 @@ require 'specinfra/command/linux'
|
|
36
37
|
require 'specinfra/command/linux/base'
|
37
38
|
require 'specinfra/command/linux/base/file'
|
38
39
|
require 'specinfra/command/linux/base/interface'
|
40
|
+
require 'specinfra/command/linux/base/inventory'
|
39
41
|
require 'specinfra/command/linux/base/iptables'
|
40
42
|
require 'specinfra/command/linux/base/ip6tables'
|
41
43
|
require 'specinfra/command/linux/base/kernel_module'
|
@@ -160,7 +162,6 @@ require 'specinfra/command/openbsd/base/interface'
|
|
160
162
|
require 'specinfra/command/openbsd/base/mail_alias'
|
161
163
|
require 'specinfra/command/openbsd/base/package'
|
162
164
|
require 'specinfra/command/openbsd/base/port'
|
163
|
-
require 'specinfra/command/openbsd/base/routing_table'
|
164
165
|
require 'specinfra/command/openbsd/base/service'
|
165
166
|
require 'specinfra/command/openbsd/base/user'
|
166
167
|
|
@@ -2,9 +2,10 @@ class Specinfra::Command::Arch::Base::Package < Specinfra::Command::Linux::Base:
|
|
2
2
|
class << self
|
3
3
|
def check_is_installed(package,version=nil)
|
4
4
|
if version
|
5
|
-
|
5
|
+
grep = version.include?('-') ? "^#{escape(version)}$" : "^#{escape(version)}-"
|
6
|
+
"pacman -Q #{escape(package)} | awk '{print $2}' | grep '#{grep}'"
|
6
7
|
else
|
7
|
-
"pacman -Q
|
8
|
+
"pacman -Q #{escape(package)}"
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
data/lib/specinfra/helper.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Specinfra
|
2
|
+
class HostInventory
|
3
|
+
include Singleton
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
property[:host_inventory] ||= {}
|
7
|
+
@inventory = property[:host_inventory]
|
8
|
+
end
|
9
|
+
|
10
|
+
def [](key)
|
11
|
+
@inventory[key.to_sym] ||= {}
|
12
|
+
if @inventory[key.to_sym].empty?
|
13
|
+
@inventory[key.to_sym] = Specinfra::Runner.send("get_inventory_#{key}")
|
14
|
+
end
|
15
|
+
@inventory[key.to_sym]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/specinfra/processor.rb
CHANGED
@@ -123,21 +123,12 @@ module Specinfra
|
|
123
123
|
|
124
124
|
ret.stdout.gsub!(/\r\n/, "\n")
|
125
125
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
}
|
133
|
-
else
|
134
|
-
ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+\n(?:default via (\S+))?/
|
135
|
-
actual_attr = {
|
136
|
-
:destination => $1,
|
137
|
-
:gateway => $2 ? $2 : $4,
|
138
|
-
:interface => expected_attr[:interface] ? $3 : nil
|
139
|
-
}
|
140
|
-
end
|
126
|
+
ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+\n(?:default via (\S+))?/
|
127
|
+
actual_attr = {
|
128
|
+
:destination => $1,
|
129
|
+
:gateway => $2 ? $2 : $4,
|
130
|
+
:interface => expected_attr[:interface] ? $3 : nil
|
131
|
+
}
|
141
132
|
|
142
133
|
expected_attr.each do |key, val|
|
143
134
|
return false if actual_attr[key] != val
|
@@ -153,16 +144,31 @@ module Specinfra
|
|
153
144
|
ret.stdout.gsub!(/\r\n/, "\n")
|
154
145
|
|
155
146
|
if os[:family] == 'openbsd'
|
156
|
-
|
157
|
-
|
147
|
+
# This code does not work with Ruby 1.8.7.
|
148
|
+
# So commented out.
|
149
|
+
# match = ret.stdout.match(/^(?<destination>\S+)\s+(?<gateway>\S+).*?(?<interface>\S+[0-9]+)(\s*)$/)
|
150
|
+
# match[attr]
|
158
151
|
else
|
159
152
|
ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+\n(?:default via (\S+))?/
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
153
|
+
if attr == :gateway
|
154
|
+
$2 ? $2 : $4
|
155
|
+
elsif attr == :interface
|
156
|
+
$3
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.get_inventory_memory
|
162
|
+
cmd = Specinfra.command.get(:get_inventory_memory)
|
163
|
+
ret = Specinfra.backend.run_command(cmd).stdout
|
164
|
+
memory = {}
|
165
|
+
ret.each_line do |line|
|
166
|
+
case line
|
167
|
+
when /^MemTotal:\s+(\d+) (.+)$/
|
168
|
+
memory[:total] = "#{$1}#{$2}"
|
169
|
+
end
|
165
170
|
end
|
171
|
+
memory
|
166
172
|
end
|
167
173
|
end
|
168
174
|
end
|
data/lib/specinfra/version.rb
CHANGED
metadata
CHANGED
@@ -1,109 +1,125 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: -3009863172
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- beta
|
11
|
+
- 51
|
12
|
+
version: 2.0.0.beta51
|
5
13
|
platform: ruby
|
6
|
-
authors:
|
14
|
+
authors:
|
7
15
|
- Gosuke Miyashita
|
8
16
|
autorequire:
|
9
17
|
bindir: bin
|
10
18
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
19
|
+
|
20
|
+
date: 2014-10-02 00:00:00 +09:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
14
24
|
name: net-ssh
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
25
|
prerelease: false
|
22
|
-
|
23
|
-
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
24
29
|
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 3
|
32
|
+
segments:
|
33
|
+
- 0
|
34
|
+
version: "0"
|
34
35
|
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: net-scp
|
35
39
|
prerelease: false
|
36
|
-
|
37
|
-
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
38
43
|
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
42
52
|
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.3'
|
48
|
-
type: :development
|
49
53
|
prerelease: false
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 10.1.1
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 9
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 3
|
63
|
+
version: "1.3"
|
62
64
|
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rake
|
63
68
|
prerelease: false
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 73
|
75
|
+
segments:
|
76
|
+
- 10
|
77
|
+
- 1
|
78
|
+
- 1
|
68
79
|
version: 10.1.1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
80
|
type: :development
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rspec
|
77
84
|
prerelease: false
|
78
|
-
|
79
|
-
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
80
88
|
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
90
94
|
type: :development
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rspec-its
|
91
98
|
prerelease: false
|
92
|
-
|
93
|
-
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
94
102
|
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
version: "0"
|
108
|
+
type: :development
|
109
|
+
version_requirements: *id006
|
97
110
|
description: Common layer for serverspec and itamae
|
98
|
-
email:
|
111
|
+
email:
|
99
112
|
- gosukenator@gmail.com
|
100
113
|
executables: []
|
114
|
+
|
101
115
|
extensions: []
|
116
|
+
|
102
117
|
extra_rdoc_files: []
|
103
|
-
|
104
|
-
|
105
|
-
-
|
106
|
-
-
|
118
|
+
|
119
|
+
files:
|
120
|
+
- .gitignore
|
121
|
+
- .gitmodules
|
122
|
+
- .travis.yml
|
107
123
|
- Gemfile
|
108
124
|
- Guardfile
|
109
125
|
- LICENSE.txt
|
@@ -155,6 +171,7 @@ files:
|
|
155
171
|
- lib/specinfra/command/base/group.rb
|
156
172
|
- lib/specinfra/command/base/host.rb
|
157
173
|
- lib/specinfra/command/base/interface.rb
|
174
|
+
- lib/specinfra/command/base/inventory.rb
|
158
175
|
- lib/specinfra/command/base/ip6tables.rb
|
159
176
|
- lib/specinfra/command/base/ipfilter.rb
|
160
177
|
- lib/specinfra/command/base/ipnat.rb
|
@@ -205,6 +222,7 @@ files:
|
|
205
222
|
- lib/specinfra/command/linux/base.rb
|
206
223
|
- lib/specinfra/command/linux/base/file.rb
|
207
224
|
- lib/specinfra/command/linux/base/interface.rb
|
225
|
+
- lib/specinfra/command/linux/base/inventory.rb
|
208
226
|
- lib/specinfra/command/linux/base/ip6tables.rb
|
209
227
|
- lib/specinfra/command/linux/base/iptables.rb
|
210
228
|
- lib/specinfra/command/linux/base/kernel_module.rb
|
@@ -229,7 +247,6 @@ files:
|
|
229
247
|
- lib/specinfra/command/openbsd/base/mail_alias.rb
|
230
248
|
- lib/specinfra/command/openbsd/base/package.rb
|
231
249
|
- lib/specinfra/command/openbsd/base/port.rb
|
232
|
-
- lib/specinfra/command/openbsd/base/routing_table.rb
|
233
250
|
- lib/specinfra/command/openbsd/base/service.rb
|
234
251
|
- lib/specinfra/command/openbsd/base/user.rb
|
235
252
|
- lib/specinfra/command/opensuse.rb
|
@@ -316,10 +333,12 @@ files:
|
|
316
333
|
- lib/specinfra/helper/detect_os/solaris.rb
|
317
334
|
- lib/specinfra/helper/detect_os/suse.rb
|
318
335
|
- lib/specinfra/helper/docker.rb
|
336
|
+
- lib/specinfra/helper/host_inventory.rb
|
319
337
|
- lib/specinfra/helper/lxc.rb
|
320
338
|
- lib/specinfra/helper/os.rb
|
321
339
|
- lib/specinfra/helper/properties.rb
|
322
340
|
- lib/specinfra/helper/set.rb
|
341
|
+
- lib/specinfra/host_inventory.rb
|
323
342
|
- lib/specinfra/processor.rb
|
324
343
|
- lib/specinfra/properties.rb
|
325
344
|
- lib/specinfra/runner.rb
|
@@ -334,6 +353,7 @@ files:
|
|
334
353
|
- spec/command/debian/service_spec.rb
|
335
354
|
- spec/command/factory_spec.rb
|
336
355
|
- spec/command/linux/interface_spec.rb
|
356
|
+
- spec/command/linux/inventory_spec.rb
|
337
357
|
- spec/command/linux/ip6tables_spec.rb
|
338
358
|
- spec/command/module/systemd_spec.rb
|
339
359
|
- spec/command/redhat/interface_spec.rb
|
@@ -347,31 +367,43 @@ files:
|
|
347
367
|
- spec/spec_helper.rb
|
348
368
|
- specinfra.gemspec
|
349
369
|
- wercker.yml
|
350
|
-
|
351
|
-
|
370
|
+
has_rdoc: true
|
371
|
+
homepage: ""
|
372
|
+
licenses:
|
352
373
|
- MIT
|
353
|
-
metadata: {}
|
354
374
|
post_install_message:
|
355
375
|
rdoc_options: []
|
356
|
-
|
376
|
+
|
377
|
+
require_paths:
|
357
378
|
- lib
|
358
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
359
|
-
|
379
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
380
|
+
none: false
|
381
|
+
requirements:
|
360
382
|
- - ">="
|
361
|
-
- !ruby/object:Gem::Version
|
362
|
-
|
363
|
-
|
364
|
-
|
383
|
+
- !ruby/object:Gem::Version
|
384
|
+
hash: 3
|
385
|
+
segments:
|
386
|
+
- 0
|
387
|
+
version: "0"
|
388
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
389
|
+
none: false
|
390
|
+
requirements:
|
365
391
|
- - ">"
|
366
|
-
- !ruby/object:Gem::Version
|
392
|
+
- !ruby/object:Gem::Version
|
393
|
+
hash: 25
|
394
|
+
segments:
|
395
|
+
- 1
|
396
|
+
- 3
|
397
|
+
- 1
|
367
398
|
version: 1.3.1
|
368
399
|
requirements: []
|
400
|
+
|
369
401
|
rubyforge_project:
|
370
|
-
rubygems_version:
|
402
|
+
rubygems_version: 1.6.2
|
371
403
|
signing_key:
|
372
|
-
specification_version:
|
404
|
+
specification_version: 3
|
373
405
|
summary: Common layer for serverspec and itamae
|
374
|
-
test_files:
|
406
|
+
test_files:
|
375
407
|
- spec/backend/exec/build_command_spec.rb
|
376
408
|
- spec/backend/exec/env_spec.rb
|
377
409
|
- spec/backend/ssh/build_command_spec.rb
|
@@ -382,6 +414,7 @@ test_files:
|
|
382
414
|
- spec/command/debian/service_spec.rb
|
383
415
|
- spec/command/factory_spec.rb
|
384
416
|
- spec/command/linux/interface_spec.rb
|
417
|
+
- spec/command/linux/inventory_spec.rb
|
385
418
|
- spec/command/linux/ip6tables_spec.rb
|
386
419
|
- spec/command/module/systemd_spec.rb
|
387
420
|
- spec/command/redhat/interface_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 84744a7a631801a67ee1cb4357dc3b19be41c06f
|
4
|
-
data.tar.gz: 85a4c8ca8abdb1de2c532bbfc6a54d4aa994e3df
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 5ebe9832eb880d67db5c597465cae89c4b1aec7251af8e119153d20eeca7ee300796fe9faf8b8e29fc9c91fc8239508ccc9a15e813e9c958eeabb5a844057240
|
7
|
-
data.tar.gz: 5c37468b41ed148f2512fc065b6f91125de428751ad5020fd51ba220ab4dd2869ab5e7535fb322f3d57d4af46c38dacd2a6b201cceb19ac386d620a2b789eb33
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class Specinfra::Command::Openbsd::Base::RoutingTable < Specinfra::Command::Base::RoutingTable
|
2
|
-
class << self
|
3
|
-
def check_has_entry(destination)
|
4
|
-
"route -n show -gateway | egrep '^#{destination}' | head -1"
|
5
|
-
end
|
6
|
-
|
7
|
-
alias :get_entry :check_has_entry
|
8
|
-
end
|
9
|
-
end
|