specinfra 2.30.4 → 2.31.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/lib/specinfra/command/base/file.rb +4 -2
- data/lib/specinfra/command/base/user.rb +8 -0
- data/lib/specinfra/command/linux/base/interface.rb +4 -0
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/base/file_spec.rb +4 -0
- data/spec/command/base/user_spec.rb +8 -0
- data/spec/command/linux/interface_spec.rb +4 -0
- 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: 2dc13a61147090fd939c4d508e1ac767b62d5075
|
4
|
+
data.tar.gz: 499e880d6e4ad2b70aa4d9e819ab361f69b62dd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 292d62e7dbab2ee695c68de46f3896814bbda0e82e6493c7d001fb552c8983711eb9eb3b0050eff449561a4bd71a3c6e0d6e3f861e16345ce386042fea8b7366
|
7
|
+
data.tar.gz: 9c934f322749b36c7df269966eab1f6f0c0aabd84cef41ff9a5031ed6befb915c060b007478a04f75eef2241e529d40845c87945a4ade58930d414ade467a871
|
@@ -150,8 +150,10 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
|
|
150
150
|
"mv #{escape(src)} #{escape(dest)}"
|
151
151
|
end
|
152
152
|
|
153
|
-
def link_to(link, target)
|
154
|
-
|
153
|
+
def link_to(link, target, options = {})
|
154
|
+
option = '-s'
|
155
|
+
option << 'f' if options[:force]
|
156
|
+
"ln #{option} #{escape(target)} #{escape(link)}"
|
155
157
|
end
|
156
158
|
|
157
159
|
def remove(file)
|
@@ -30,6 +30,14 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
|
|
30
30
|
"grep -w -- #{escape(key)} ~#{escape(user)}/.ssh/authorized_keys"
|
31
31
|
end
|
32
32
|
|
33
|
+
def get_minimum_days_between_password_change(user)
|
34
|
+
"chage -l #{escape(user)} | grep '^Minimum.*:' | awk -F ': ' '{print $2}'"
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_maximum_days_between_password_change(user)
|
38
|
+
"chage -l #{escape(user)} | grep '^Maximum.*:' | awk -F ': ' '{print $2}'"
|
39
|
+
end
|
40
|
+
|
33
41
|
def get_uid(user)
|
34
42
|
"id -u #{escape(user)}"
|
35
43
|
end
|
@@ -29,6 +29,10 @@ class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Int
|
|
29
29
|
ip_address.downcase!
|
30
30
|
"ip addr show #{interface} | grep 'inet6 #{ip_address}'"
|
31
31
|
end
|
32
|
+
|
33
|
+
def get_link_state(name)
|
34
|
+
"cat /sys/class/net/#{name}/operstate"
|
35
|
+
end
|
32
36
|
end
|
33
37
|
end
|
34
38
|
|
data/lib/specinfra/version.rb
CHANGED
@@ -46,6 +46,10 @@ describe get_command(:link_file_to, '/link', '/target') do
|
|
46
46
|
it { should eq 'ln -s /target /link' }
|
47
47
|
end
|
48
48
|
|
49
|
+
describe get_command(:link_file_to, '/link', '/target', :force => true) do
|
50
|
+
it { should eq 'ln -sf /target /link' }
|
51
|
+
end
|
52
|
+
|
49
53
|
describe get_command(:remove_file, '/tmp') do
|
50
54
|
it { should eq 'rm -rf /tmp' }
|
51
55
|
end
|
@@ -42,6 +42,14 @@ describe get_command(:check_user_has_login_shell, 'foo', '/bin/sh') do
|
|
42
42
|
it { should eq "getent passwd foo | cut -f 7 -d ':' | grep -w -- /bin/sh" }
|
43
43
|
end
|
44
44
|
|
45
|
+
describe get_command(:get_user_minimum_days_between_password_change, 'foo') do
|
46
|
+
it { should eq "chage -l foo | grep '^Minimum.*:' | awk -F ': ' '{print $2}'" }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe get_command(:get_user_maximum_days_between_password_change, 'foo') do
|
50
|
+
it { should eq "chage -l foo | grep '^Maximum.*:' | awk -F ': ' '{print $2}'" }
|
51
|
+
end
|
52
|
+
|
45
53
|
describe get_command(:get_user_login_shell, 'foo') do
|
46
54
|
it { should eq "getent passwd foo | cut -f 7 -d ':'" }
|
47
55
|
end
|
@@ -6,3 +6,7 @@ set :os, :family => 'linux'
|
|
6
6
|
describe get_command(:check_interface_has_ipv6_address, 'eth0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee') do
|
7
7
|
it { should eq "ip addr show eth0 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/'" }
|
8
8
|
end
|
9
|
+
|
10
|
+
describe get_command(:get_interface_link_state, 'eth0') do
|
11
|
+
it { should eq "cat /sys/class/net/eth0/operstate" }
|
12
|
+
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.
|
4
|
+
version: 2.31.0
|
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-05-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|