specinfra 2.0.0.beta11 → 2.0.0.beta12
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/lib/specinfra/command/aix/base/file.rb +3 -3
- data/lib/specinfra/command/aix/base/user.rb +1 -1
- data/lib/specinfra/command/arch/base/file.rb +8 -1
- data/lib/specinfra/command/base/file.rb +9 -9
- data/lib/specinfra/command/base/user.rb +2 -2
- data/lib/specinfra/command/darwin/base/file.rb +2 -2
- data/lib/specinfra/command/freebsd/base/file.rb +1 -1
- data/lib/specinfra/command/linux/base/file.rb +1 -1
- data/lib/specinfra/command/linux/base/interface.rb +1 -1
- data/lib/specinfra/command/linux/base/selinux.rb +3 -1
- data/lib/specinfra/command/openbsd/base/file.rb +1 -1
- data/lib/specinfra/command/openbsd/base/interface.rb +8 -1
- data/lib/specinfra/command/redhat/base/file.rb +1 -1
- data/lib/specinfra/command/solaris/base/file.rb +4 -4
- data/lib/specinfra/command/solaris/base/user.rb +1 -1
- data/lib/specinfra/command/solaris/v10/file.rb +1 -1
- data/lib/specinfra/command/solaris/v10/user.rb +1 -1
- data/lib/specinfra/command/windows/base/file.rb +4 -9
- data/lib/specinfra/command/windows/base/user.rb +1 -1
- data/lib/specinfra/version.rb +1 -1
- data/wercker.yml +15 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e83660b824856312827345a04517188e064c1e6
|
4
|
+
data.tar.gz: ecf35e4263f0b93b3a9db776bab43c0ebc207081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb2b8b616fa33bb47882acd858c0a0ac46db3f2b50209863ad639c3b0dc679d7ad8d885056d9b3791677646544774e2a10451af06b0fcaee2a9c16d4cfa5388e
|
7
|
+
data.tar.gz: 60d9cb2c010eae33245ee8737267e012554bf538c6cf352ba5b5262701b017cf90681033d2b4a1071b0680804851b0722393227b9bd100612cf238222960a67a
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class Specinfra::Command::Aix::Base::File < Specinfra::Command::Base::File
|
2
|
-
def
|
2
|
+
def check_is_accessible_by_user(file, user, access)
|
3
3
|
"su -s sh -c \"test -#{access} #{file}\" #{user}"
|
4
4
|
end
|
5
5
|
|
6
|
-
def
|
7
|
-
raise NotImplementedError.new('
|
6
|
+
def check_has_mode(file, mode)
|
7
|
+
raise NotImplementedError.new('check_has_mode is not implemented in Specinfra::Command::AIX::Base::File')
|
8
8
|
end
|
9
9
|
|
10
10
|
def check_is_owned_by(file, owner)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Specinfra::Command::Aix::Base::User < Specinfra::Command::Base::User
|
2
|
-
def
|
2
|
+
def check_belongs_to_group(user, group)
|
3
3
|
"lsuser -a groups #{escape(user)} | awk -F'=' '{print $2}'| sed -e 's/,/ /g' |grep -w -- #{escape(group)}"
|
4
4
|
end
|
5
5
|
|
@@ -1,5 +1,12 @@
|
|
1
1
|
class Specinfra::Command::Arch::Base::File < Specinfra::Command::Linux::Base::File
|
2
|
-
def
|
2
|
+
def check_is_accessible_by_user(file, user, access)
|
3
3
|
"runuser -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
|
4
4
|
end
|
5
5
|
end
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
@@ -11,8 +11,8 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
|
|
11
11
|
"test -S #{escape(file)}"
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
"#{
|
14
|
+
def check_contains(file, expected_pattern)
|
15
|
+
"#{check_file_contains_with_regexp(file, expected_pattern)} || #{check_file_contains_with_fixed_strings(file, expected_pattern)}"
|
16
16
|
end
|
17
17
|
|
18
18
|
def check_is_grouped(file, group)
|
@@ -25,21 +25,21 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
|
|
25
25
|
"stat -c %U #{escape(file)} | grep -- #{escape(regexp)}"
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def check_has_mode(file, mode)
|
29
29
|
regexp = "^#{mode}$"
|
30
30
|
"stat -c %a #{escape(file)} | grep -- #{escape(regexp)}"
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def check_contains_within(file, expected_pattern, from=nil, to=nil)
|
34
34
|
from ||= '1'
|
35
35
|
to ||= '$'
|
36
36
|
sed = "sed -n #{escape(from)},#{escape(to)}p #{escape(file)}"
|
37
|
-
checker_with_regexp =
|
38
|
-
checker_with_fixed =
|
37
|
+
checker_with_regexp = check_file_contains_with_regexp("-", expected_pattern)
|
38
|
+
checker_with_fixed = check_file_contains_with_fixed_strings("-", expected_pattern)
|
39
39
|
"#{sed} | #{checker_with_regexp} || #{sed} | #{checker_with_fixed}"
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def check_contains_lines(file, expected_lines, from=nil, to=nil)
|
43
43
|
require 'digest/md5'
|
44
44
|
from ||= '1'
|
45
45
|
to ||= '$'
|
@@ -50,11 +50,11 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
|
|
50
50
|
"#{sed} | grep -A #{escape(afterwards_length)} -F -- #{escape(head_line)} | md5sum | grep -qiw -- #{escape(lines_checksum)}"
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def check_contains_with_regexp(file, expected_pattern)
|
54
54
|
"grep -q -- #{escape(expected_pattern)} #{escape(file)}"
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def check_contains_with_fixed_strings(file, expected_pattern)
|
58
58
|
"grep -qF -- #{escape(expected_pattern)} #{escape(file)}"
|
59
59
|
end
|
60
60
|
|
@@ -3,11 +3,11 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
|
|
3
3
|
"id #{escape(user)}"
|
4
4
|
end
|
5
5
|
|
6
|
-
def
|
6
|
+
def check_belongs_to_group(user, group)
|
7
7
|
"id #{escape(user)} | awk '{print $3}' | grep -- #{escape(group)}"
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def check_belongs_to_primary_group(user, group)
|
11
11
|
"id -gn #{escape(user)}| grep ^#{escape(group)}$"
|
12
12
|
end
|
13
13
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Specinfra::Command::Darwin::Base::File < Specinfra::Command::Base::File
|
2
|
-
def
|
2
|
+
def check_is_accessible_by_user(file, user, access)
|
3
3
|
"sudo -u #{user} -s /bin/test -#{access} #{file}"
|
4
4
|
end
|
5
5
|
|
@@ -15,7 +15,7 @@ class Specinfra::Command::Darwin::Base::File < Specinfra::Command::Base::File
|
|
15
15
|
"stat -f %Y #{escape(link)} | grep -- #{escape(target)}"
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def check_has_mode(file, mode)
|
19
19
|
regexp = "^#{mode}$"
|
20
20
|
"stat -f%Lp #{escape(file)} | grep -- #{escape(regexp)}"
|
21
21
|
end
|
@@ -3,7 +3,7 @@ class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Int
|
|
3
3
|
"ethtool #{name} | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\\/s/,\"\\\\1\",\"\")}'"
|
4
4
|
end
|
5
5
|
|
6
|
-
def
|
6
|
+
def check_has_ipv4_address(interface, ip_address)
|
7
7
|
ip_address = ip_address.dup
|
8
8
|
if ip_address =~ /\/\d+$/
|
9
9
|
ip_address << " "
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Specinfra::Command::Linux::Base::Selinux < Specinfra::Command::Base::Selinux
|
2
|
-
def
|
2
|
+
def check_has_mode(mode)
|
3
3
|
cmd = ""
|
4
4
|
cmd += "test ! -f /etc/selinux/config || (" if mode == "disabled"
|
5
5
|
cmd += "getenforce | grep -i -- #{escape(mode)} "
|
@@ -8,3 +8,5 @@ class Specinfra::Command::Linux::Base::Selinux < Specinfra::Command::Base::Selin
|
|
8
8
|
cmd
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
|
@@ -13,7 +13,7 @@ class Specinfra::Command::Openbsd::Base::File < Specinfra::Command::Base::File
|
|
13
13
|
"stat -f %Y #{escape(link)} | grep -- #{escape(target)}"
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def check_has_mode(file, mode)
|
17
17
|
regexp = "^#{mode}$"
|
18
18
|
"stat -f%Lp #{escape(file)} | grep #{escape(regexp)}"
|
19
19
|
end
|
@@ -3,7 +3,14 @@ class Specinfra::Command::Openbsd::Base::Interface < Specinfra::Command::Base::I
|
|
3
3
|
"ifconfig #{name} | grep 'media\:' | perl -pe 's|.*media\:.*\\((.*?)\\)|\\1|'"
|
4
4
|
end
|
5
5
|
|
6
|
-
def
|
6
|
+
def check_has_ipv4_address(interface, ip_address)
|
7
7
|
"ifconfig #{interface} | grep -w inet | cut -d ' ' -f 2"
|
8
8
|
end
|
9
9
|
end
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class Specinfra::Command::Redhat::Base::File < Specinfra::Command::Linux::Base::File
|
2
|
-
def
|
2
|
+
def check_is_accessible_by_user(file, user, access)
|
3
3
|
# Redhat-specific
|
4
4
|
"runuser -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
|
5
5
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
class Specinfra::Command::Solaris::Base::File < Specinfra::Command::Base::File
|
2
|
-
def
|
2
|
+
def check_contains_within(file, expected_pattern, from=nil, to=nil)
|
3
3
|
from ||= '1'
|
4
4
|
to ||= '$'
|
5
5
|
sed = "sed -n #{escape(from)},#{escape(to)}p #{escape(file)}"
|
6
|
-
checker_with_regexp =
|
7
|
-
checker_with_fixed =
|
6
|
+
checker_with_regexp = check_file_contains_with_regexp("/dev/stdin", expected_pattern)
|
7
|
+
checker_with_fixed = check_file_contains_with_fixed_strings("/dev/stdin", expected_pattern)
|
8
8
|
"#{sed} | #{checker_with_regexp} || #{sed} | #{checker_with_fixed}"
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def check_is_accessible_by_user(file, user, access)
|
12
12
|
# http://docs.oracle.com/cd/E23823_01/html/816-5166/su-1m.html
|
13
13
|
## No need for login shell as it seems that behavior as superuser is favorable for us, but needs
|
14
14
|
## to be better tested under real solaris env
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Specinfra::Command::Solaris::V10::File < Specinfra::Command::Solaris::Base::File
|
2
2
|
# reference: http://perldoc.perl.org/functions/stat.html
|
3
|
-
def
|
3
|
+
def check_has_mode(file, mode)
|
4
4
|
regexp = "^#{mode}$"
|
5
5
|
"perl -e 'printf \"%o\", (stat shift)[2]&07777' #{escape(file)} | grep -- #{escape(regexp)}"
|
6
6
|
end
|
@@ -38,7 +38,7 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
|
|
38
38
|
"[Io.File]::ReadAllText('#{file}')"
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def check_is_accessible_by_user(file, user, access)
|
42
42
|
case access
|
43
43
|
when 'r'
|
44
44
|
check_is_readable(file, user)
|
@@ -70,13 +70,13 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
def
|
73
|
+
def check_contains(file, pattern)
|
74
74
|
Backend::PowerShell::Command.new do
|
75
75
|
exec "[Io.File]::ReadAllText('#{file}') -match '#{convert_regexp(pattern)}'"
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
79
|
+
def check_contains_within file, pattern, from=nil, to=nil
|
80
80
|
from ||= '^'
|
81
81
|
to ||= '$'
|
82
82
|
Backend::PowerShell::Command.new do
|
@@ -85,7 +85,7 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
def
|
88
|
+
def check_has_version(name,version)
|
89
89
|
cmd = "((Get-Command '#{name}').FileVersionInfo.ProductVersion -eq '#{version}') -or ((Get-Command '#{name}').FileVersionInfo.FileVersion -eq '#{version}')"
|
90
90
|
Backend::PowerShell::Command.new { exec cmd }
|
91
91
|
end
|
@@ -96,8 +96,3 @@ class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Bas
|
|
96
96
|
end
|
97
97
|
|
98
98
|
end
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
@@ -7,7 +7,7 @@ class Specinfra::Command::Windows::Base::User < Specinfra::Command::Windows::Bas
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
10
|
+
def check_belongs_to_group(user, group)
|
11
11
|
user_id, user_domain = windows_account user
|
12
12
|
group_id, group_domain = windows_account group
|
13
13
|
Backend::PowerShell::Command.new do
|
data/lib/specinfra/version.rb
CHANGED
data/wercker.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
box: mizzy/serverspec-base
|
1
|
+
box: mizzy/serverspec-base@0.0.3
|
2
2
|
build:
|
3
3
|
steps:
|
4
4
|
- script:
|
@@ -34,6 +34,18 @@ build:
|
|
34
34
|
name: Run rake spec:centos65
|
35
35
|
code: rake spec:centos65
|
36
36
|
cwd: $WORKING_DIR
|
37
|
+
- script:
|
38
|
+
name: Run vagrant up centos70
|
39
|
+
code: vagrant up centos70 --provider=digital_ocean
|
40
|
+
cwd: $WORKING_DIR
|
41
|
+
- script:
|
42
|
+
name: Run vagrant reload centos70
|
43
|
+
code: vagrant reload centos70
|
44
|
+
cwd: $WORKING_DIR
|
45
|
+
- script:
|
46
|
+
name: Run rake spec:centos70
|
47
|
+
code: rake spec:centos70
|
48
|
+
cwd: $WORKING_DIR
|
37
49
|
- script:
|
38
50
|
name: Run vagrant up ubuntu1404
|
39
51
|
code: vagrant up ubuntu1404 --provider=digital_ocean
|
@@ -49,12 +61,8 @@ build:
|
|
49
61
|
|
50
62
|
after-steps:
|
51
63
|
- script:
|
52
|
-
name: Run vagrant destroy
|
53
|
-
code: vagrant destroy
|
54
|
-
cwd: $WORKING_DIR
|
55
|
-
- script:
|
56
|
-
name: Run vagrant destroy ubuntu1404
|
57
|
-
code: vagrant destroy ubuntu1404 --force
|
64
|
+
name: Run vagrant destroy
|
65
|
+
code: vagrant destroy --force
|
58
66
|
cwd: $WORKING_DIR
|
59
67
|
- 1syo/idobata-notify@0.1.1:
|
60
68
|
token: $IDOBATA_TOKEN
|
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.0.0.
|
4
|
+
version: 2.0.0.beta12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|