specinfra 2.82.13 → 2.82.14

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: 4091da838326377ef94b07ae9b26011de7769fb9
4
- data.tar.gz: 4157f26e7591567eece6b67067e1aa1fb3da32f7
3
+ metadata.gz: 149c1e2722e441af453f1eca0da8bc9f6e639097
4
+ data.tar.gz: b7eb2635ebfaf3b7119e1103da9ed96861abd956
5
5
  SHA512:
6
- metadata.gz: 21aa8c43ffd5c01fe64a4c380b4729d6c93511277196925db37e9c836d8c1a3354c588c10affbbb34693d51761e4a5ca6d2f89a16d261f2cfbcdb9b41a08cd48
7
- data.tar.gz: db8d758cd7964e6af9a70792d78ccaec01d63f395e371ccb3a7c8e888c00bfb56e321411760b174e66c458b48d55b775f9d7ec1739563b8047428a060362bc41
6
+ metadata.gz: 30dc8b7ac56e049c1e29a71fe7f473ce14c58e4387a61b0b8c5c9206862c09a2a30838ee8d5131c0c8865f37ec955c987d8687a54710c41410736a48c1b0d1fc
7
+ data.tar.gz: 3e28985de56c4995daa461278ffaea599c80e6e443f410039971e61410029eaa7c4679d0dbb84cfb82b64a2d95a58999f02423d1804bca885aa290026abe9ff0
@@ -1,15 +1,17 @@
1
1
  class Specinfra::Command::Base::User < Specinfra::Command::Base
2
2
  class << self
3
3
  def check_exists(user)
4
- "id #{escape(user)}"
4
+ "getent passwd #{escape(user)}"
5
5
  end
6
6
 
7
7
  def check_belongs_to_group(user, group)
8
- "id #{escape(user)} | sed 's/ context=.*//g' | cut -f 4 -d '=' | grep -- #{escape(group)}"
8
+ "groups #{escape(user)} | grep -- #{escape(group)}"
9
9
  end
10
10
 
11
11
  def check_belongs_to_primary_group(user, group)
12
- "id -gn #{escape(user)}| grep ^#{escape(group)}$"
12
+ pgid = "getent passwd #{escape(user)} | cut -f 4 -d ':'"
13
+ ggid = "getent group #{escape(group)} | cut -f 3 -d ':'"
14
+ %Q|test "#{escape(pgid)}" -eq "#{escape(ggid)}"|
13
15
  end
14
16
 
15
17
  def check_is_system_user(user)
@@ -21,8 +23,8 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
21
23
  end
22
24
 
23
25
  def check_has_uid(user, uid)
24
- regexp = "^uid=#{uid}("
25
- "id #{escape(user)} | grep -- #{escape(regexp)}"
26
+ auid = "getent passwd #{escape(user)} | cut -f 3 -d ':'"
27
+ %Q| test "#{escape(uid)}" -eq "#{escape(auid)}"|
26
28
  end
27
29
 
28
30
  def check_has_home_directory(user, path_to_home)
@@ -47,11 +49,11 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
47
49
  end
48
50
 
49
51
  def get_uid(user)
50
- "id -u #{escape(user)}"
52
+ "getent passwd #{escape(user)} | cut -f 3 -d ':'"
51
53
  end
52
54
 
53
55
  def get_gid(user)
54
- "id -g #{escape(user)}"
56
+ "getent passwd #{escape(user)} | cut -f 4 -d ':'"
55
57
  end
56
58
 
57
59
  def get_home_directory(user)
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.82.13"
2
+ VERSION = "2.82.14"
3
3
  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.82.13
4
+ version: 2.82.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-01 00:00:00.000000000 Z
11
+ date: 2020-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp