specinfra 2.28.4 → 2.29.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/user.rb +9 -0
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/base/user_spec.rb +13 -2
- 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: 89db6e31e081e6722c466847d897042eadfe5871
|
4
|
+
data.tar.gz: fd0586975df1af3bf980a66dc10df9882fb4d84e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea495a7d4fedb865c5fb1b5b18e512d30276dc3a2c207ad1e38f5f58030cc5c54e0e9b187d0dda147a42fa1adab44f9f7c0d8c60c8652afb711ef90ebb2c59fb
|
7
|
+
data.tar.gz: a603f678b1e2d19e4b052fbe6fe3bdffadca5d44d7d448d7a196c7c6651728489c883668007a53ee64e0bc33238814ab4609a6f87bd05faee33b8da8447ead6c
|
@@ -42,10 +42,18 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
|
|
42
42
|
"getent passwd #{escape(user)} | awk -F: '{ print $6 }'"
|
43
43
|
end
|
44
44
|
|
45
|
+
def get_login_shell(user)
|
46
|
+
"getent passwd #{escape(user)} | cut -f 7 -d ':'"
|
47
|
+
end
|
48
|
+
|
45
49
|
def update_home_directory(user, directory)
|
46
50
|
"usermod -d #{escape(directory)} #{escape(user)}"
|
47
51
|
end
|
48
52
|
|
53
|
+
def update_login_shell(user, shell)
|
54
|
+
"usermod -s #{escape(shell)} #{escape(user)}"
|
55
|
+
end
|
56
|
+
|
49
57
|
def update_uid(user, uid)
|
50
58
|
"usermod -u #{escape(uid)} #{escape(user)}"
|
51
59
|
end
|
@@ -59,6 +67,7 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
|
|
59
67
|
command << '-g' << escape(options[:gid]) if options[:gid]
|
60
68
|
command << '-d' << escape(options[:home_directory]) if options[:home_directory]
|
61
69
|
command << '-p' << escape(options[:password]) if options[:password]
|
70
|
+
command << '-s' << escape(options[:shell]) if options[:shell]
|
62
71
|
command << '-m' if options[:create_home]
|
63
72
|
command << '-r' if options[:system_user]
|
64
73
|
command << '-u' << escape(options[:uid]) if options[:uid]
|
data/lib/specinfra/version.rb
CHANGED
@@ -26,8 +26,8 @@ describe get_command(:update_user_gid, 'foo', 100) do
|
|
26
26
|
it { should eq 'usermod -g 100 foo' }
|
27
27
|
end
|
28
28
|
|
29
|
-
describe get_command(:add_user, 'foo', :home_directory => '/home/foo', :password => '$6$foo/bar', :create_home => true) do
|
30
|
-
it { should eq 'useradd -d /home/foo -p \$6\$foo/bar -m foo' }
|
29
|
+
describe get_command(:add_user, 'foo', :home_directory => '/home/foo', :password => '$6$foo/bar', :shell => '/bin/tcsh', :create_home => true) do
|
30
|
+
it { should eq 'useradd -d /home/foo -p \$6\$foo/bar -s /bin/tcsh -m foo' }
|
31
31
|
end
|
32
32
|
|
33
33
|
describe get_command(:update_user_encrypted_password, 'foo', 'xxxxxxxx') do
|
@@ -38,3 +38,14 @@ describe get_command(:get_user_encrypted_password, 'foo') do
|
|
38
38
|
it { should eq "getent shadow foo | awk -F: '{ print $2 }'" }
|
39
39
|
end
|
40
40
|
|
41
|
+
describe get_command(:check_user_has_login_shell, 'foo', '/bin/sh') do
|
42
|
+
it { should eq "getent passwd foo | cut -f 7 -d ':' | grep -w -- /bin/sh" }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe get_command(:get_user_login_shell, 'foo') do
|
46
|
+
it { should eq "getent passwd foo | cut -f 7 -d ':'" }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe get_command(:update_user_login_shell, 'foo', '/bin/bash') do
|
50
|
+
it { should eq 'usermod -s /bin/bash foo' }
|
51
|
+
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.29.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-04-
|
11
|
+
date: 2015-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|