itamae 1.0.0.beta28 → 1.0.0.beta29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/itamae/cli.rb +2 -2
- data/lib/itamae/resource/user.rb +6 -0
- data/lib/itamae/version.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e6c40f7ec418f602cc9c3656ab52e2911ef569a
|
4
|
+
data.tar.gz: ae5a65e894d475f4001ba6e81ceee410eee7a2a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb64b1eeb4a24e68384acb26cbac4f3bf71f152b7df88c9daeb13a271db796b9162d945d31871ea500cd5309db4ba627f2346dedaf709b9147fb8f08cf6fb4b
|
7
|
+
data.tar.gz: c806857b5bc48e363d19320926e21db59833b38da307a9db0615591edf2c232495d13a030bbd3a22f81601e0ac3ead9b09a9bb7be938768701250a01de3ef968
|
data/lib/itamae/cli.rb
CHANGED
@@ -15,7 +15,7 @@ module Itamae
|
|
15
15
|
|
16
16
|
desc "local RECIPE [RECIPE...]", "Run Itamae locally"
|
17
17
|
option :node_json, type: :string, aliases: ['-j']
|
18
|
-
option :dry_run, type: :
|
18
|
+
option :dry_run, type: :boolean, aliases: ['-n']
|
19
19
|
option :ohai, type: :boolean, default: false
|
20
20
|
def local(*recipe_files)
|
21
21
|
Runner.run(recipe_files, :local, options)
|
@@ -23,7 +23,7 @@ module Itamae
|
|
23
23
|
|
24
24
|
desc "ssh RECIPE [RECIPE...]", "Run Itamae via ssh"
|
25
25
|
option :node_json, type: :string, aliases: ['-j']
|
26
|
-
option :dry_run, type: :
|
26
|
+
option :dry_run, type: :boolean, aliases: ['-n']
|
27
27
|
option :host, required: true, type: :string, aliases: ['-h']
|
28
28
|
option :user, type: :string, aliases: ['-u']
|
29
29
|
option :key, type: :string, aliases: ['-i']
|
data/lib/itamae/resource/user.rb
CHANGED
@@ -15,6 +15,7 @@ module Itamae
|
|
15
15
|
@current_attributes[:exist?] = exist?
|
16
16
|
|
17
17
|
if @current_attributes[:exist?]
|
18
|
+
# TODO: delegate to Specinfra
|
18
19
|
@current_attributes[:uid] = run_command(["id", "-u", username]).stdout.strip
|
19
20
|
@current_attributes[:gid] = run_command(["id", "-g", username]).stdout.strip
|
20
21
|
@current_attributes[:home] = run_command("echo ~#{shell_escape(username)}").stdout.strip
|
@@ -25,20 +26,24 @@ module Itamae
|
|
25
26
|
def create_action
|
26
27
|
if run_specinfra(:check_user_exists, username)
|
27
28
|
if uid && uid.to_s != @current_attributes[:uid]
|
29
|
+
# TODO: delegate to Specinfra
|
28
30
|
run_command(["usermod", "-u", uid, username])
|
29
31
|
updated!
|
30
32
|
end
|
31
33
|
|
32
34
|
if gid && gid.to_s != @current_attributes[:gid]
|
35
|
+
# TODO: delegate to Specinfra
|
33
36
|
run_command(["usermod", "-g", gid, username])
|
34
37
|
updated!
|
35
38
|
end
|
36
39
|
|
37
40
|
if password && password != current_password
|
41
|
+
# TODO: delegate to Specinfra
|
38
42
|
run_command("echo #{shell_escape("#{username}:#{password}")} | chpasswd -e")
|
39
43
|
updated!
|
40
44
|
end
|
41
45
|
else
|
46
|
+
# TODO: delegate to Specinfra
|
42
47
|
args = ["useradd"]
|
43
48
|
args << "-g" << gid if gid
|
44
49
|
args << "-d" << home if home
|
@@ -58,6 +63,7 @@ module Itamae
|
|
58
63
|
end
|
59
64
|
|
60
65
|
def current_password
|
66
|
+
# TODO: delegate to Specinfra
|
61
67
|
result = run_command("cat /etc/shadow | grep -E ^#{shell_escape(username)}:", error: false)
|
62
68
|
|
63
69
|
if result.exit_status == 0
|
data/lib/itamae/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.beta29
|