itamae 1.9.9 → 1.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/itamae.gemspec +1 -1
- data/lib/itamae/backend.rb +1 -0
- data/lib/itamae/recipe.rb +1 -1
- data/lib/itamae/resource/base.rb +1 -1
- data/lib/itamae/resource/file.rb +9 -9
- data/lib/itamae/resource/git.rb +2 -0
- data/lib/itamae/resource/link.rb +2 -1
- data/lib/itamae/version.rb +1 -1
- data/spec/integration/default_spec.rb +30 -0
- data/spec/integration/recipes/default.rb +48 -0
- data/spec/integration/recipes/included.rb +4 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5c2bbaa65e9c33670186255fd00fcd0ec14a7d9
|
4
|
+
data.tar.gz: 71f925946fb5f63bd562b918c28756d389caa5e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c7e267d4bcf255cdebb1b88a83821664a4de6ef43a9757ca963ad74fa94fb79f3fbe7bb1f2f71c1ed472b02160f0d0bb11e081dc16e4ad208498a71de17a2b0
|
7
|
+
data.tar.gz: 4500e83e08902ab1ab61abd886f5be02f74c351df2a8e9465e4dbf4bc430317255a3640c68f78607235c16ae544c98c15cc025b7c94008fe9b35942801e7c110
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
## v1.9.10
|
2
|
+
|
3
|
+
Features
|
4
|
+
|
5
|
+
- [Add depth attribute to git resource](https://github.com/itamae-kitchen/itamae/pull/219)
|
6
|
+
- [Support force link a direcotory](https://github.com/itamae-kitchen/itamae/pull/229)
|
7
|
+
- [Add support password authentication for ssh](https://github.com/itamae-kitchen/itamae/pull/227)
|
8
|
+
|
9
|
+
Bugfixes
|
10
|
+
|
11
|
+
- [Run a resource subscribing a resource in child recipe](https://github.com/itamae-kitchen/itamae/pull/224)
|
12
|
+
- [Change file owner first, then change file permissions](https://github.com/itamae-kitchen/itamae/pull/228)
|
13
|
+
|
14
|
+
Improvements
|
15
|
+
|
16
|
+
- [Dir.exists? is deprecated, use Dir.exist?](https://github.com/itamae-kitchen/itamae/pull/226)
|
17
|
+
|
1
18
|
## v1.9.9
|
2
19
|
|
3
20
|
Features
|
data/itamae.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_runtime_dependency "thor"
|
21
|
-
spec.add_runtime_dependency "specinfra", [">= 2.
|
21
|
+
spec.add_runtime_dependency "specinfra", [">= 2.64.0", "< 3.0.0"]
|
22
22
|
spec.add_runtime_dependency "hashie"
|
23
23
|
spec.add_runtime_dependency "ansi"
|
24
24
|
spec.add_runtime_dependency "schash", "~> 0.1.0"
|
data/lib/itamae/backend.rb
CHANGED
@@ -234,6 +234,7 @@ module Itamae
|
|
234
234
|
ssh_config_files = @options[:ssh_config] ? [@options[:ssh_config]] : Net::SSH::Config.default_files
|
235
235
|
opts.merge!(Net::SSH::Config.for(@options[:host], ssh_config_files))
|
236
236
|
opts[:user] = @options[:user] || opts[:user] || Etc.getlogin
|
237
|
+
opts[:password] = @options[:password] if @options[:password]
|
237
238
|
opts[:keys] = [@options[:key]] if @options[:key]
|
238
239
|
opts[:port] = @options[:port] if @options[:port]
|
239
240
|
|
data/lib/itamae/recipe.rb
CHANGED
@@ -121,7 +121,7 @@ module Itamae
|
|
121
121
|
|
122
122
|
def include_recipe(target)
|
123
123
|
expanded_path = ::File.expand_path(target, File.dirname(@recipe.path))
|
124
|
-
expanded_path = ::File.join(expanded_path, 'default.rb') if ::Dir.
|
124
|
+
expanded_path = ::File.join(expanded_path, 'default.rb') if ::Dir.exist?(expanded_path)
|
125
125
|
expanded_path.concat('.rb') unless expanded_path.end_with?('.rb')
|
126
126
|
candidate_paths = [expanded_path, Recipe.find_recipe_in_gem(target)].compact
|
127
127
|
path = candidate_paths.find {|path| File.exist?(path) }
|
data/lib/itamae/resource/base.rb
CHANGED
@@ -337,7 +337,7 @@ module Itamae
|
|
337
337
|
end
|
338
338
|
|
339
339
|
def notify
|
340
|
-
(notifications +
|
340
|
+
(notifications + runner.children.subscribing(self)).each do |notification|
|
341
341
|
message = "Notifying #{notification.action} to #{notification.action_resource.resource_type} resource '#{notification.action_resource.resource_name}'"
|
342
342
|
|
343
343
|
if notification.delayed?
|
data/lib/itamae/resource/file.rb
CHANGED
@@ -64,14 +64,14 @@ module Itamae
|
|
64
64
|
|
65
65
|
change_target = attributes.modified ? @temppath : attributes.path
|
66
66
|
|
67
|
-
if attributes.mode
|
68
|
-
run_specinfra(:change_file_mode, change_target, attributes.mode)
|
69
|
-
end
|
70
|
-
|
71
67
|
if attributes.owner || attributes.group
|
72
68
|
run_specinfra(:change_file_owner, change_target, attributes.owner, attributes.group)
|
73
69
|
end
|
74
70
|
|
71
|
+
if attributes.mode
|
72
|
+
run_specinfra(:change_file_mode, change_target, attributes.mode)
|
73
|
+
end
|
74
|
+
|
75
75
|
if attributes.modified
|
76
76
|
run_specinfra(:move_file, @temppath, attributes.path)
|
77
77
|
end
|
@@ -86,17 +86,17 @@ module Itamae
|
|
86
86
|
def action_edit(options)
|
87
87
|
change_target = attributes.modified ? @temppath : attributes.path
|
88
88
|
|
89
|
-
if attributes.mode || attributes.modified
|
90
|
-
mode = attributes.mode || run_specinfra(:get_file_mode, attributes.path).stdout.chomp
|
91
|
-
run_specinfra(:change_file_mode, change_target, mode)
|
92
|
-
end
|
93
|
-
|
94
89
|
if attributes.owner || attributes.group || attributes.modified
|
95
90
|
owner = attributes.owner || run_specinfra(:get_file_owner_user, attributes.path).stdout.chomp
|
96
91
|
group = attributes.group || run_specinfra(:get_file_owner_group, attributes.path).stdout.chomp
|
97
92
|
run_specinfra(:change_file_owner, change_target, owner, group)
|
98
93
|
end
|
99
94
|
|
95
|
+
if attributes.mode || attributes.modified
|
96
|
+
mode = attributes.mode || run_specinfra(:get_file_mode, attributes.path).stdout.chomp
|
97
|
+
run_specinfra(:change_file_mode, change_target, mode)
|
98
|
+
end
|
99
|
+
|
100
100
|
if attributes.modified
|
101
101
|
run_specinfra(:move_file, @temppath, attributes.path)
|
102
102
|
end
|
data/lib/itamae/resource/git.rb
CHANGED
@@ -10,6 +10,7 @@ module Itamae
|
|
10
10
|
define_attribute :repository, type: String, required: true
|
11
11
|
define_attribute :revision, type: String
|
12
12
|
define_attribute :recursive, type: [TrueClass, FalseClass], default: false
|
13
|
+
define_attribute :depth, type: Integer
|
13
14
|
|
14
15
|
def pre_action
|
15
16
|
case @current_action
|
@@ -30,6 +31,7 @@ module Itamae
|
|
30
31
|
if check_empty_dir
|
31
32
|
cmd = ['git', 'clone']
|
32
33
|
cmd << '--recursive' if attributes.recursive
|
34
|
+
cmd += ['--depth', attributes.depth.to_s] if attributes.depth
|
33
35
|
cmd << attributes.repository << attributes.destination
|
34
36
|
run_command(cmd)
|
35
37
|
new_repository = true
|
data/lib/itamae/resource/link.rb
CHANGED
@@ -25,7 +25,8 @@ module Itamae
|
|
25
25
|
|
26
26
|
def action_create(options)
|
27
27
|
unless run_specinfra(:check_file_is_linked_to, attributes.link, attributes.to)
|
28
|
-
run_specinfra(:link_file_to, attributes.link, attributes.to,
|
28
|
+
run_specinfra(:link_file_to, attributes.link, attributes.to,
|
29
|
+
force: attributes.force, no_dereference: attributes.force)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
data/lib/itamae/version.rb
CHANGED
@@ -57,6 +57,13 @@ describe file('/tmp/file') do
|
|
57
57
|
it { should be_mode 777 }
|
58
58
|
end
|
59
59
|
|
60
|
+
describe file('/tmp/file_with_suid') do
|
61
|
+
it { should be_file }
|
62
|
+
it { should be_mode 4755 }
|
63
|
+
it { should be_owned_by "itamae" }
|
64
|
+
it { should be_grouped_into "itamae" }
|
65
|
+
end
|
66
|
+
|
60
67
|
describe file('/tmp/execute') do
|
61
68
|
it { should be_file }
|
62
69
|
its(:content) { should match(/Hello Execute/) }
|
@@ -141,6 +148,14 @@ describe file('/tmp-link-force') do
|
|
141
148
|
it { should be_linked_to '/tmp' }
|
142
149
|
end
|
143
150
|
|
151
|
+
describe file('/tmp/link-force-no-dereference') do
|
152
|
+
it { should be_linked_to 'link-force-no-dereference2' }
|
153
|
+
end
|
154
|
+
|
155
|
+
describe file('/tmp/link-force-no-dereference/link-force-no-dereference2') do
|
156
|
+
it { should_not exist }
|
157
|
+
end
|
158
|
+
|
144
159
|
describe command('cd /tmp/git_repo && git rev-parse HEAD') do
|
145
160
|
its(:stdout) { should match(/3116e170b89dc0f7315b69c1c1e1fd7fab23ac0d/) }
|
146
161
|
end
|
@@ -149,6 +164,10 @@ describe command('cd /tmp/git_repo_submodule/empty_repo && cat README.md') do
|
|
149
164
|
its(:stdout) { should match(/Empty Repo/) }
|
150
165
|
end
|
151
166
|
|
167
|
+
describe command('cd /tmp/git_repo_depth_1 && git rev-list --count HEAD') do
|
168
|
+
its(:stdout) { should eq "1\n" }
|
169
|
+
end
|
170
|
+
|
152
171
|
describe file('/tmp/created_by_itamae_user') do
|
153
172
|
it { should be_file }
|
154
173
|
it { should be_owned_by 'itamae' }
|
@@ -216,6 +235,13 @@ describe file('/tmp/file_edit_sample') do
|
|
216
235
|
it { should be_grouped_into "itamae2" }
|
217
236
|
end
|
218
237
|
|
238
|
+
describe file('/tmp/file_edit_with_suid') do
|
239
|
+
it { should be_file }
|
240
|
+
it { should be_mode 4755 }
|
241
|
+
it { should be_owned_by "itamae2" }
|
242
|
+
it { should be_grouped_into "itamae2" }
|
243
|
+
end
|
244
|
+
|
219
245
|
describe file('/tmp/file_edit_keeping_mode_owner') do
|
220
246
|
it { should be_file }
|
221
247
|
its(:content) { should eq("Hello, Itamae") }
|
@@ -263,3 +289,7 @@ end
|
|
263
289
|
describe file('/tmp/file_without_content_change_keeping_timestamp') do
|
264
290
|
its(:mtime) { should eq(DateTime.iso8601("2016-05-01T12:34:56Z")) }
|
265
291
|
end
|
292
|
+
|
293
|
+
describe file('/tmp/subscribed_from_parent') do
|
294
|
+
it { should be_file }
|
295
|
+
end
|
@@ -173,6 +173,13 @@ file "/tmp/file" do
|
|
173
173
|
mode "777"
|
174
174
|
end
|
175
175
|
|
176
|
+
file "/tmp/file_with_suid" do
|
177
|
+
content "Hello World"
|
178
|
+
mode "4755"
|
179
|
+
owner "itamae"
|
180
|
+
group "itamae"
|
181
|
+
end
|
182
|
+
|
176
183
|
execute "echo 'Hello Execute' > /tmp/execute"
|
177
184
|
|
178
185
|
file "/tmp/never_exist1" do
|
@@ -262,6 +269,22 @@ link "/tmp-link-force" do
|
|
262
269
|
force true
|
263
270
|
end
|
264
271
|
|
272
|
+
######
|
273
|
+
|
274
|
+
execute "mkdir /tmp/link-force-no-dereference1"
|
275
|
+
link "link-force-no-dereference" do
|
276
|
+
cwd "/tmp"
|
277
|
+
to "link-force-no-dereference1"
|
278
|
+
force true
|
279
|
+
end
|
280
|
+
|
281
|
+
execute "mkdir /tmp/link-force-no-dereference2"
|
282
|
+
link "link-force-no-dereference" do
|
283
|
+
cwd "/tmp"
|
284
|
+
to "link-force-no-dereference2"
|
285
|
+
force true
|
286
|
+
end
|
287
|
+
|
265
288
|
#####
|
266
289
|
|
267
290
|
local_ruby_block "greeting" do
|
@@ -284,6 +307,11 @@ git "/tmp/git_repo_submodule" do
|
|
284
307
|
recursive true
|
285
308
|
end
|
286
309
|
|
310
|
+
git "/tmp/git_repo_depth_1" do
|
311
|
+
repository "https://github.com/ryotarai/infrataster.git"
|
312
|
+
depth 1
|
313
|
+
end
|
314
|
+
|
287
315
|
#####
|
288
316
|
|
289
317
|
execute "echo -n \"$HOME\n$(pwd)\" > /tmp/created_by_itamae_user" do
|
@@ -411,6 +439,20 @@ file '/tmp/file_edit_sample' do
|
|
411
439
|
notifies :run, "execute[echo -n 1 > /tmp/file_edit_notifies]"
|
412
440
|
end
|
413
441
|
|
442
|
+
file '/tmp/file_edit_with_suid' do
|
443
|
+
content 'Hello, world'
|
444
|
+
owner 'itamae'
|
445
|
+
group 'itamae'
|
446
|
+
mode '600'
|
447
|
+
end
|
448
|
+
|
449
|
+
file '/tmp/file_edit_with_suid' do
|
450
|
+
action :edit
|
451
|
+
owner 'itamae2'
|
452
|
+
group 'itamae2'
|
453
|
+
mode '4755'
|
454
|
+
end
|
455
|
+
|
414
456
|
file '/tmp/file_edit_keeping_mode_owner' do
|
415
457
|
content 'Hello, world'
|
416
458
|
owner 'itamae'
|
@@ -507,6 +549,11 @@ local_ruby_block 'execute run_command' do
|
|
507
549
|
end
|
508
550
|
end
|
509
551
|
|
552
|
+
execute "touch /tmp/subscribed_from_parent" do
|
553
|
+
action :nothing
|
554
|
+
subscribes :run, 'execute[subscribed from parent]'
|
555
|
+
end
|
556
|
+
|
510
557
|
###
|
511
558
|
|
512
559
|
v1 = node.memory.total
|
@@ -516,3 +563,4 @@ v3 = node['memory']['total']
|
|
516
563
|
unless v1 == v2 && v2 == v3 && v1 =~ /\A\d+kB\z/
|
517
564
|
raise "failed to fetch host inventory value (#{v1}, #{v2}, #{v3})"
|
518
565
|
end
|
566
|
+
|
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.
|
4
|
+
version: 1.9.10
|
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-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.64.0
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 3.0.0
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
43
|
+
version: 2.64.0
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 3.0.0
|