itamae 1.2.19 → 1.2.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/itamae/node.rb +6 -1
- data/lib/itamae/resource/base.rb +7 -2
- data/lib/itamae/version.txt +1 -1
- data/spec/integration/recipes/default.rb +10 -0
- data/spec/unit/lib/itamae/backend_spec.rb +11 -10
- data/spec/unit/lib/itamae/resource/base_spec.rb +12 -1
- data/spec/unit/lib/itamae/runner_spec.rb +1 -1
- data/spec/unit/spec_helper.rb +2 -1
- 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: ebe55a32ee69f26e86a9b90f98d09c2962eaae96
|
4
|
+
data.tar.gz: 12681aa3d8e0883562ef20f025f745bc1a00df71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a825854a1ab504152f6052ddafa9774bdb3a465924202d4025116757723e929b5c9cdde536c8eee3e3241da302905d71ba135d4f0c4ce000c5baec04fdcc8041
|
7
|
+
data.tar.gz: f6afc1d44a0606695bd373d586194d7e9fe64bba44a7cc8f8a594ad27cf7ff8c7e5117d6bc62853a9ead300c1888e8829a83000fb210439768e43ce7a1768006
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## v1.2.21
|
2
|
+
|
3
|
+
Improvements
|
4
|
+
|
5
|
+
- [Show error message when specified action is unavailable in dry_run mode (by @eagletmt)](https://github.com/itamae-kitchen/itamae/pull/137)
|
6
|
+
- [Fix deprecation warnings in unit tests (by @eagletmt)](https://github.com/itamae-kitchen/itamae/pull/138)
|
7
|
+
|
8
|
+
## v1.2.20
|
9
|
+
|
10
|
+
Improvements
|
11
|
+
|
12
|
+
- [Wrap host inventory value with Hashie::Mash to access it by a method call](https://github.com/itamae-kitchen/itamae/pull/135)
|
13
|
+
|
1
14
|
## v1.2.19
|
2
15
|
|
3
16
|
Features
|
data/lib/itamae/node.rb
CHANGED
@@ -61,7 +61,12 @@ module Itamae
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def fetch_inventory_value(key)
|
64
|
-
@backend.host_inventory[key]
|
64
|
+
value = @backend.host_inventory[key]
|
65
|
+
if value.is_a?(Hash)
|
66
|
+
value = Hashie::Mash.new(value)
|
67
|
+
end
|
68
|
+
|
69
|
+
value
|
65
70
|
rescue NotImplementedError, NameError
|
66
71
|
nil
|
67
72
|
end
|
data/lib/itamae/resource/base.rb
CHANGED
@@ -184,8 +184,13 @@ module Itamae
|
|
184
184
|
Logger.debug "(in show_differences)"
|
185
185
|
show_differences
|
186
186
|
|
187
|
-
|
188
|
-
|
187
|
+
method_name = "action_#{action}"
|
188
|
+
if options[:dry_run]
|
189
|
+
unless respond_to?(method_name)
|
190
|
+
Logger.error "action #{action.inspect} is unavailable"
|
191
|
+
end
|
192
|
+
else
|
193
|
+
public_send(method_name, options)
|
189
194
|
end
|
190
195
|
|
191
196
|
updated! if different?
|
data/lib/itamae/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.21
|
@@ -335,3 +335,13 @@ local_ruby_block 'execute run_command' do
|
|
335
335
|
end
|
336
336
|
end
|
337
337
|
end
|
338
|
+
|
339
|
+
###
|
340
|
+
|
341
|
+
v1 = node.memory.total
|
342
|
+
v2 = node[:memory][:total]
|
343
|
+
v3 = node['memory']['total']
|
344
|
+
|
345
|
+
unless v1 == v2 && v2 == v3 && v1 =~ /\A\d+kB\z/
|
346
|
+
raise "failed to fetch host inventory value (#{v1}, #{v2}, #{v3})"
|
347
|
+
end
|
@@ -7,47 +7,48 @@ module Itamae
|
|
7
7
|
include FakeFS::SpecHelpers
|
8
8
|
|
9
9
|
class Klass < Itamae::Backend::Base
|
10
|
-
def initialize(_)
|
11
|
-
@backend =
|
12
|
-
@backend.stub(:send_file)
|
13
|
-
@backend.stub(:send_directory)
|
10
|
+
def initialize(_, backend)
|
11
|
+
@backend = backend
|
14
12
|
end
|
15
13
|
end
|
16
14
|
|
15
|
+
let(:backend) { double('backend', send_file: nil, send_directory: nil) }
|
16
|
+
let(:itamae_backend) { Klass.new('dummy', backend) }
|
17
|
+
|
17
18
|
describe ".send_file" do
|
18
19
|
context "the source file doesn't exist" do
|
19
|
-
subject { -> {
|
20
|
+
subject { -> { itamae_backend.send_file("src", "dst") } }
|
20
21
|
it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "The file 'src' doesn't exist.") }
|
21
22
|
end
|
22
23
|
|
23
24
|
context "the source file exist, but it is not a regular file" do
|
24
25
|
before { Dir.mkdir("src") }
|
25
|
-
subject { -> {
|
26
|
+
subject { -> { itamae_backend.send_file("src", "dst") } }
|
26
27
|
it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a file.") }
|
27
28
|
end
|
28
29
|
|
29
30
|
context "the source file is a regular file" do
|
30
31
|
before { FileUtils.touch("src") }
|
31
|
-
subject { -> {
|
32
|
+
subject { -> { itamae_backend.send_file("src", "dst") } }
|
32
33
|
it { expect { subject }.not_to raise_error }
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
37
|
describe ".send_directory" do
|
37
38
|
context "the source directory doesn't exist" do
|
38
|
-
subject { -> {
|
39
|
+
subject { -> { itamae_backend.send_directory("src", "dst") } }
|
39
40
|
it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "The directory 'src' doesn't exist.") }
|
40
41
|
end
|
41
42
|
|
42
43
|
context "the source directory exist, but it is not a directory" do
|
43
44
|
before { FileUtils.touch("src") }
|
44
|
-
subject { -> {
|
45
|
+
subject { -> { itamae_backend.send_directory("src", "dst") } }
|
45
46
|
it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a directory.") }
|
46
47
|
end
|
47
48
|
|
48
49
|
context "the source directory is a directory" do
|
49
50
|
before { Dir.mkdir("src") }
|
50
|
-
subject { -> {
|
51
|
+
subject { -> { itamae_backend.send_directory("src", "dst") } }
|
51
52
|
it { expect { subject }.not_to raise_error }
|
52
53
|
end
|
53
54
|
end
|
@@ -106,17 +106,28 @@ describe TestResource do
|
|
106
106
|
end
|
107
107
|
let(:recipe) do
|
108
108
|
double(:recipe).tap do |r|
|
109
|
-
r.
|
109
|
+
allow(r).to receive(:runner).and_return(runner)
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
113
|
describe "#run" do
|
114
114
|
before do
|
115
115
|
subject.attributes.action = :name
|
116
|
+
allow(Itamae::Logger).to receive(:debug) # suppress logger output
|
116
117
|
end
|
118
|
+
|
117
119
|
it "executes <ACTION_NAME>_action method" do
|
118
120
|
expect(subject).to receive(:action_name)
|
119
121
|
subject.run
|
120
122
|
end
|
123
|
+
|
124
|
+
context 'with dry_run' do
|
125
|
+
context 'when specified action is unavailable' do
|
126
|
+
it 'logs error' do
|
127
|
+
expect(Itamae::Logger).to receive(:error).with(/action :name is unavailable/)
|
128
|
+
subject.run(nil, dry_run: true)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
121
132
|
end
|
122
133
|
end
|
data/spec/unit/spec_helper.rb
CHANGED
@@ -7,7 +7,6 @@ require 'itamae'
|
|
7
7
|
#
|
8
8
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
9
|
RSpec.configure do |config|
|
10
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
10
|
config.run_all_when_everything_filtered = true
|
12
11
|
config.filter_run :focus
|
13
12
|
|
@@ -16,6 +15,8 @@ RSpec.configure do |config|
|
|
16
15
|
# the seed, which is printed after each run.
|
17
16
|
# --seed 1234
|
18
17
|
config.order = 'random'
|
18
|
+
|
19
|
+
config.raise_errors_for_deprecations!
|
19
20
|
end
|
20
21
|
|
21
22
|
Itamae::Logger.log_device = StringIO.new
|
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.2.
|
4
|
+
version: 1.2.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|