specinfra 2.28.4 → 2.29.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: c99ff54bdf0c869ed893ccc5b971f51ae6bf95c0
4
- data.tar.gz: edd1f04b11eaa1c0d4876ef38cf28344266a7234
3
+ metadata.gz: 89db6e31e081e6722c466847d897042eadfe5871
4
+ data.tar.gz: fd0586975df1af3bf980a66dc10df9882fb4d84e
5
5
  SHA512:
6
- metadata.gz: 6dbd5c4dcb234fba2b256f4563506c76822bd41e3bbecec8c1b40d038dca5a4e24beb0c830184a8b8da5839df6877be90054a5c120c80f4fbf27c8bb85e63f76
7
- data.tar.gz: aff947585ef5c6d2b767b6b97d55c781232a3bd59a0a44d1224ecbc593acc3f846d9b36c95321ecbb8d1ddc6aa1775afd9512cdb4d68383fa44ee94a876ac5da
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]
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.28.4"
2
+ VERSION = "2.29.0"
3
3
  end
@@ -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.28.4
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-17 00:00:00.000000000 Z
11
+ date: 2015-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh