specinfra 2.10.1 → 2.10.2

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: 752878a5e1f9c4c66e0e694a35828a41c053bb3b
4
- data.tar.gz: f6810917014d94fd00fda3eb729588b170cef32f
3
+ metadata.gz: 4c8087fc1817c4d6e1a1dc711e5f05f694b2fab5
4
+ data.tar.gz: f4768d95e77d0931029d1f744d6eefc53dc12eea
5
5
  SHA512:
6
- metadata.gz: efc924c21e4b6f7a0a890637b7b8024a01916a283e5a50125f5c66a13fcfa16b5bdc7dffd4bb293db6e056c6a647501528a420991a423b0856d2cd49f6a72f25
7
- data.tar.gz: 680480acdbb6bc4b9de4f38770cffecad7839efc3559dbf49b5199daf90f701e4624ee1a60453fcc1c0cc84bb78add357b3e75a90dd5ab28c3338b085494c203
6
+ metadata.gz: dacb29480b50fc0bb3a6b93026f57bd20ec4b8cd2c7850fcc8e64e4f29655fafef050a50a6f36bfd7194ade4d5a6e709108e7fd224d4d5f28f9bd7d1a10ad2c0
7
+ data.tar.gz: 30a25b04745a2597e456f2afa72d2030f35e727d0370b3c35d9556ea8e2057c00039a1abe2a2e06b40771e67a116fd774cb1d7bbcf7d0a34bc067ee3771aac93
@@ -26,12 +26,20 @@ class Specinfra::Command::Base::File < Specinfra::Command::Base
26
26
 
27
27
  def check_is_grouped(file, group)
28
28
  regexp = "^#{group}$"
29
- "stat -c %G #{escape(file)} | grep -- #{escape(regexp)}"
29
+ if group.is_a?(Numeric) || (group =~ /\A\d+\z/ ? true : false)
30
+ "stat -c %g #{escape(file)} | grep -- #{escape(regexp)}"
31
+ else
32
+ "stat -c %G #{escape(file)} | grep -- #{escape(regexp)}"
33
+ end
30
34
  end
31
35
 
32
36
  def check_is_owned_by(file, owner)
33
37
  regexp = "^#{owner}$"
34
- "stat -c %U #{escape(file)} | grep -- #{escape(regexp)}"
38
+ if owner.is_a?(Numeric) || (owner =~ /\A\d+\z/ ? true : false)
39
+ "stat -c %u #{escape(file)} | grep -- #{escape(regexp)}"
40
+ else
41
+ "stat -c %U #{escape(file)} | grep -- #{escape(regexp)}"
42
+ end
35
43
  end
36
44
 
37
45
  def check_has_mode(file, mode)
@@ -52,12 +52,12 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
52
52
 
53
53
  def add(user, options)
54
54
  command = ['useradd']
55
- command << '-g' << options[:gid] if options[:gid]
56
- command << '-d' << options[:home_directory] if options[:home_directory]
57
- command << '-p' << options[:password] if options[:password]
55
+ command << '-g' << escape(options[:gid]) if options[:gid]
56
+ command << '-d' << escape(options[:home_directory]) if options[:home_directory]
57
+ command << '-p' << escape(options[:password]) if options[:password]
58
58
  command << '-r' if options[:system_user]
59
- command << '-u' << options[:uid] if options[:uid]
60
- command << user
59
+ command << '-u' << escape(options[:uid]) if options[:uid]
60
+ command << escape(user)
61
61
  command.join(' ')
62
62
  end
63
63
 
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.10.1"
2
+ VERSION = "2.10.2"
3
3
  end
@@ -22,8 +22,8 @@ describe get_command(:update_user_gid, 'foo', 100) do
22
22
  it { should eq 'usermod -g 100 foo' }
23
23
  end
24
24
 
25
- describe get_command(:add_user, 'foo', :home_directory => '/home/foo') do
26
- it { should eq 'useradd -d /home/foo foo' }
25
+ describe get_command(:add_user, 'foo', :home_directory => '/home/foo', :password => '$6$foo/bar') do
26
+ it { should eq 'useradd -d /home/foo -p \$6\$foo/bar foo' }
27
27
  end
28
28
 
29
29
  describe get_command(:update_user_encrypted_password, 'foo', 'xxxxxxxx') do
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.10.1
4
+ version: 2.10.2
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-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh