itamae 1.0.0.beta28 → 1.0.0.beta29

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 710ad7e0b74c9481270f46dbd3770667d7f976b1
4
- data.tar.gz: 87341f1c3733b3bc88733013fb3f3dd620ef7adc
3
+ metadata.gz: 1e6c40f7ec418f602cc9c3656ab52e2911ef569a
4
+ data.tar.gz: ae5a65e894d475f4001ba6e81ceee410eee7a2a2
5
5
  SHA512:
6
- metadata.gz: 9ed18ecbf3dfd0f0ba72b6112c07712f23c386e698a42601e925454c0841469c08b60fbc978f2587206f5f8edb2ff1bc3ef5e1e8d7d469ef0b04a5128457d360
7
- data.tar.gz: 6a9e781b54749f87d0c4c9f35add213d302ec133dde426697a650d1c0697d87a5a9b0d4d9c7d9e634fef40abbb9e6de1c5d9613029c4ebd9bebc9c7f74586b20
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: :string, aliases: ['-n']
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: :string, aliases: ['-n']
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']
@@ -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
@@ -1 +1 @@
1
- 1.0.0.beta28
1
+ 1.0.0.beta29
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta28
4
+ version: 1.0.0.beta29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai