itamae 1.9.5 → 1.9.6.pre

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: 69eb224b93a5e9bfb3144ea3a867c430335bd42b
4
- data.tar.gz: 1cdcb57ab16cd5fcc3263ab47fb2c79a6d4505d8
3
+ metadata.gz: 14409d3a6bd062fc5a82ab1f828997e0baaab839
4
+ data.tar.gz: 5bb922bb81f5e95896177156414e3552cf905c10
5
5
  SHA512:
6
- metadata.gz: 7b99272fc2ec58d6ddb79054ef9613982011ac10d3674fcb2c53b22fc1f81def84f0d4975c3c151d9860c8e48919c776e26af315bd1000544191df880bb53269
7
- data.tar.gz: 6e11b47673437f304e4a12e1bb3e0ee3a7893d9260929b7d39058f6571b08c65c35570395fcc06cfe05d41274cd1caab74b85287bc177e94df551e8f26895f82
6
+ metadata.gz: ffe3d8752faec72b45cc79312a9ddeb050e1cf0456b675eefc6b8529960fb35d3bfa8d37c454c66fb82b69bda08cbf07891a4d313bcfd9ac6b3c09fb60c2c88a
7
+ data.tar.gz: c69551e8b91dd3f8de16b09e068ce3ab0fb9592ff1933a22845c5476689ca28278e1bb8e549b4094e40ab29d4cad861f64ede12f26a9d440e5f44d76860b9bed
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## v1.9.6 (pre)
2
+
3
+ Features
4
+
5
+ - [Introduce `--detailed-exitcode` option.](https://github.com/itamae-kitchen/itamae/pull/206)
6
+
7
+ Bugfixes
8
+
9
+ - [If `git rev-list` fails, do `git fetch origin`](https://github.com/itamae-kitchen/itamae/pull/205)
10
+ - [If gid passed to user resource is a String, treat it as group name.](https://github.com/itamae-kitchen/itamae/pull/207)
11
+
1
12
  ## v1.9.5
2
13
 
3
14
  Bugfixes
data/Rakefile CHANGED
@@ -80,22 +80,3 @@ namespace :spec do
80
80
  end
81
81
  end
82
82
 
83
- namespace :release do
84
- desc "Bump up version and commit"
85
- task :version_up do
86
- version_file = File.expand_path("lib/itamae/version.txt")
87
- current_version = File.read(version_file).strip
88
-
89
- if /\A(.+?)(\d+)\z/ =~ current_version
90
- next_version = "#{$1}#{$2.to_i + 1}"
91
- else
92
- raise "Invalid version"
93
- end
94
-
95
- open(version_file, "w") do |f|
96
- f.write next_version
97
- end
98
- system "git add #{version_file}"
99
- system "git commit -m 'Bump up version'"
100
- end
101
- end
data/lib/itamae/cli.rb CHANGED
@@ -24,6 +24,7 @@ module Itamae
24
24
  option :shell, type: :string, default: "/bin/sh"
25
25
  option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be unavailable."
26
26
  option :profile, type: :string, desc: "[EXPERIMENTAL] Save profiling data", banner: "PATH"
27
+ option :detailed_exitcode, type: :boolean, default: false, desc: "exit code 0 - The run succeeded with no changes or failures, exit code 1 - The run failed, exit code 2 - The run succeeded, and some resources were changed"
27
28
  end
28
29
 
29
30
  desc "local RECIPE [RECIPE...]", "Run Itamae locally"
@@ -33,7 +34,7 @@ module Itamae
33
34
  raise "Please specify recipe files."
34
35
  end
35
36
 
36
- Runner.run(recipe_files, :local, options)
37
+ run(recipe_files, :local, options)
37
38
  end
38
39
 
39
40
  desc "ssh RECIPE [RECIPE...]", "Run Itamae via ssh"
@@ -54,7 +55,7 @@ module Itamae
54
55
  raise "Please set '-h <hostname>' or '--vagrant'"
55
56
  end
56
57
 
57
- Runner.run(recipe_files, :ssh, options)
58
+ run(recipe_files, :ssh, options)
58
59
  end
59
60
 
60
61
  desc "docker RECIPE [RECIPE...]", "Create Docker image"
@@ -67,7 +68,7 @@ module Itamae
67
68
  raise "Please specify recipe files."
68
69
  end
69
70
 
70
- Runner.run(recipe_files, :docker, options)
71
+ run(recipe_files, :docker, options)
71
72
  end
72
73
 
73
74
  desc "version", "Print version"
@@ -118,5 +119,12 @@ module Itamae
118
119
  fail InvocationError, msg
119
120
  end
120
121
  end
122
+
123
+ def run(recipe_files, backend_type, options)
124
+ runner = Runner.run(recipe_files, backend_type, options)
125
+ if options[:detailed_exitcode] && runner.diff?
126
+ exit 2
127
+ end
128
+ end
121
129
  end
122
130
  end
@@ -139,6 +139,7 @@ module Itamae
139
139
 
140
140
  verify unless runner.dry_run?
141
141
  if updated?
142
+ runner.diff_found!
142
143
  notify
143
144
  runner.handler.event(:resource_updated)
144
145
  end
@@ -72,7 +72,11 @@ module Itamae
72
72
  end
73
73
 
74
74
  def run_command_in_repo(*args)
75
- run_command(*args, cwd: attributes.destination)
75
+ unless args.last.is_a?(Hash)
76
+ args << {}
77
+ end
78
+ args.last[:cwd] = attributes.destination
79
+ run_command(*args)
76
80
  end
77
81
 
78
82
  def current_branch
@@ -80,7 +84,11 @@ module Itamae
80
84
  end
81
85
 
82
86
  def get_revision(branch)
83
- run_command_in_repo("git rev-list #{shell_escape(branch)} | head -n1").stdout.strip
87
+ result = run_command_in_repo("git rev-list #{shell_escape(branch)}", error: false)
88
+ unless result.exit_status == 0
89
+ fetch_origin!
90
+ end
91
+ run_command_in_repo("git rev-list #{shell_escape(branch)}").stdout.lines.first.strip
84
92
  end
85
93
 
86
94
  def fetch_origin!
@@ -18,6 +18,11 @@ module Itamae
18
18
  when :create
19
19
  attributes.exist = true
20
20
  end
21
+
22
+ if attributes.gid.is_a?(String)
23
+ # convert name to gid
24
+ attributes.gid = run_specinfra(:get_group_gid, attributes.gid).stdout.to_i
25
+ end
21
26
  end
22
27
 
23
28
  def set_current_attributes
data/lib/itamae/runner.rb CHANGED
@@ -12,6 +12,8 @@ module Itamae
12
12
  runner = self.new(backend, options)
13
13
  runner.load_recipes(recipe_files)
14
14
  runner.run
15
+
16
+ runner
15
17
  end
16
18
  end
17
19
 
@@ -31,6 +33,7 @@ module Itamae
31
33
  @node = create_node
32
34
  @tmpdir = "/tmp/itamae_tmp"
33
35
  @children = RecipeChildren.new
36
+ @diff = false
34
37
 
35
38
  @backend.run_command(["mkdir", "-p", @tmpdir])
36
39
  @backend.run_command(["chmod", "777", @tmpdir])
@@ -80,6 +83,14 @@ module Itamae
80
83
  end
81
84
  end
82
85
 
86
+ def diff?
87
+ @diff
88
+ end
89
+
90
+ def diff_found!
91
+ @diff = true
92
+ end
93
+
83
94
  private
84
95
  def create_node
85
96
  hash = {}
@@ -1,3 +1,3 @@
1
1
  module Itamae
2
- VERSION = File.read(File.expand_path("../version.txt", __FILE__)).strip
2
+ VERSION = "1.9.6.pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 1.9.6.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-15 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -265,7 +265,6 @@ files:
265
265
  - lib/itamae/resource/user.rb
266
266
  - lib/itamae/runner.rb
267
267
  - lib/itamae/version.rb
268
- - lib/itamae/version.txt
269
268
  - spec/integration/Vagrantfile
270
269
  - spec/integration/default_spec.rb
271
270
  - spec/integration/recipes/default.rb
@@ -309,9 +308,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
309
308
  version: '0'
310
309
  required_rubygems_version: !ruby/object:Gem::Requirement
311
310
  requirements:
312
- - - ">="
311
+ - - ">"
313
312
  - !ruby/object:Gem::Version
314
- version: '0'
313
+ version: 1.3.1
315
314
  requirements: []
316
315
  rubyforge_project:
317
316
  rubygems_version: 2.5.1
@@ -1 +0,0 @@
1
- 1.9.5