specinfra 2.30.4 → 2.31.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3556a045acc26ba89cb3c811637a6f97b8c54559
4
- data.tar.gz: 97dde6aab9a00e94b0d1c1548ae2aa1790ba7d95
3
+ metadata.gz: 2dc13a61147090fd939c4d508e1ac767b62d5075
4
+ data.tar.gz: 499e880d6e4ad2b70aa4d9e819ab361f69b62dd2
5
5
  SHA512:
6
- metadata.gz: 23754a1f0eeef9789d3775d939ed55d42b04f87cdbc7c6b4f0d2587b93a9b8e1a0f5bb6146a807b204fcd8304990a75029cb011e4a1991318971edf1f7c79779
7
- data.tar.gz: 3d918516d7e09dfccb5ce1ca40778d2d2c1ff74e21267b1aaaa1c3a04284f4d8e3569ec66d6f4ebb7f386756104cb5e4b2fadfd0a8fa0e1d524e2b584e282cb0
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
- "ln -s #{escape(target)} #{escape(link)}"
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
 
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.30.4"
2
+ VERSION = "2.31.0"
3
3
  end
@@ -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.30.4
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-05 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh