itamae 1.10.5 → 1.10.10
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 +4 -4
- data/.travis.yml +3 -1
- data/CHANGELOG.md +38 -1
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/lib/itamae/backend.rb +6 -1
- data/lib/itamae/logger.rb +1 -0
- data/lib/itamae/resource/base.rb +1 -0
- data/lib/itamae/resource/file.rb +34 -1
- data/lib/itamae/resource/git.rb +5 -5
- data/lib/itamae/resource/package.rb +3 -1
- data/lib/itamae/version.rb +1 -1
- data/spec/integration/default_spec.rb +1 -1
- data/spec/integration/recipes/default.rb +4 -4
- data/spec/unit/lib/itamae/backend_spec.rb +10 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a27b553f519a4e36fdc40534d8033528f3dfbbca42133fed38c8af9bafc0234c
|
4
|
+
data.tar.gz: d3b9da92d9ebaa0c4f3ceff9f483944e1fa02d2a28741c921c3b16f283b083cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cf3758a3778d8a22128d08263f03bbf10c2ea53246128013786bda0c44549a14b89792798db43e5de573264fe06a5c3e8049cf52837db46d086e84f528c10c6
|
7
|
+
data.tar.gz: 86f33c85a7deed7cb93993abe8e811e0dd6e84861350ac48f7fae462a6fdca9e3c9b9a1c6ccf8438af326fc77829a5f0eb1d4e848aed6efe36d29739393467f3
|
data/.travis.yml
CHANGED
@@ -8,13 +8,13 @@ rvm:
|
|
8
8
|
- 2.4
|
9
9
|
- 2.5
|
10
10
|
- 2.6
|
11
|
+
- 2.7
|
11
12
|
- ruby-head
|
12
13
|
bundler_args: "--jobs=4 --retry=3"
|
13
14
|
cache:
|
14
15
|
bundler: true
|
15
16
|
|
16
17
|
before_install:
|
17
|
-
- travis_retry gem update --system || travis_retry gem update --system 2.7.8
|
18
18
|
- travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
|
19
19
|
|
20
20
|
script:
|
@@ -29,6 +29,8 @@ matrix:
|
|
29
29
|
include:
|
30
30
|
- rvm: 2.6
|
31
31
|
env: SPEC_RUBYOPT="--jit"
|
32
|
+
- rvm: 2.7
|
33
|
+
env: SPEC_RUBYOPT="--jit"
|
32
34
|
- rvm: ruby-head
|
33
35
|
env: SPEC_RUBYOPT="--jit"
|
34
36
|
branches:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.
|
2
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.10...master)
|
3
|
+
|
4
|
+
## v1.10.10
|
5
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.9...v1.10.10)
|
6
|
+
|
7
|
+
Improvements
|
8
|
+
|
9
|
+
- [Make output unbuffered](https://github.com/itamae-kitchen/itamae/pull/317)
|
10
|
+
|
11
|
+
## v1.10.9
|
12
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.8...v1.10.9)
|
13
|
+
|
14
|
+
Improvements
|
15
|
+
|
16
|
+
- [Fix CRLF problem in windows](https://github.com/itamae-kitchen/itamae/pull/316)
|
17
|
+
|
18
|
+
## v1.10.8
|
19
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.7...v1.10.8)
|
20
|
+
|
21
|
+
Improvements
|
22
|
+
|
23
|
+
- [Print "(in action_XXX)" as a debug log](https://github.com/itamae-kitchen/itamae/pull/315)
|
24
|
+
- [Reduce `check_package_is_installed` calling when package version is not specified](https://github.com/itamae-kitchen/itamae/pull/314)
|
25
|
+
- [Simplify Git resource's get_revision method](https://github.com/itamae-kitchen/itamae/pull/313)
|
26
|
+
|
27
|
+
## v1.10.7
|
28
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.6...v1.10.7)
|
29
|
+
|
30
|
+
Improvements
|
31
|
+
|
32
|
+
- [Improve `file` resource performance](https://github.com/itamae-kitchen/itamae/pull/310)
|
33
|
+
|
34
|
+
## v1.10.6
|
35
|
+
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.5...v1.10.6)
|
36
|
+
|
37
|
+
Improvements
|
38
|
+
|
39
|
+
- [Don't use `sudo` when `--no-sudo` is passed](https://github.com/itamae-kitchen/itamae/pull/302)
|
3
40
|
|
4
41
|
## v1.10.5
|
5
42
|
[full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.4...v1.10.5)
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ $ bundle exec rake spec
|
|
77
77
|
|
78
78
|
## Get Involved
|
79
79
|
|
80
|
-
- [Join Slack team](https://
|
80
|
+
- [Join Slack team](https://itamae-slackin.herokuapp.com)
|
81
81
|
|
82
82
|
## Presentations / Articles
|
83
83
|
|
data/Rakefile
CHANGED
data/lib/itamae/backend.rb
CHANGED
@@ -188,7 +188,7 @@ module Itamae
|
|
188
188
|
end
|
189
189
|
|
190
190
|
user = options[:user]
|
191
|
-
if user
|
191
|
+
if user && use_sudo?
|
192
192
|
command = "cd ~#{user.shellescape} ; #{command}"
|
193
193
|
command = "sudo -H -u #{user.shellescape} -- #{shell.shellescape} -c #{command.shellescape}"
|
194
194
|
end
|
@@ -196,6 +196,11 @@ module Itamae
|
|
196
196
|
command
|
197
197
|
end
|
198
198
|
|
199
|
+
def use_sudo?
|
200
|
+
return true unless @options.key?(:sudo)
|
201
|
+
!!@options[:sudo]
|
202
|
+
end
|
203
|
+
|
199
204
|
def shell
|
200
205
|
@options[:shell] || '/bin/sh'
|
201
206
|
end
|
data/lib/itamae/logger.rb
CHANGED
data/lib/itamae/resource/base.rb
CHANGED
data/lib/itamae/resource/file.rb
CHANGED
@@ -9,6 +9,10 @@ module Itamae
|
|
9
9
|
define_attribute :group, type: String
|
10
10
|
define_attribute :block, type: Proc, default: proc {}
|
11
11
|
|
12
|
+
class << self
|
13
|
+
attr_accessor :sha256sum_available
|
14
|
+
end
|
15
|
+
|
12
16
|
def pre_action
|
13
17
|
current.exist = run_specinfra(:check_file_is_file, attributes.path)
|
14
18
|
|
@@ -27,6 +31,11 @@ module Itamae
|
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
34
|
+
if exists_and_not_modified?
|
35
|
+
attributes.modified = false
|
36
|
+
return
|
37
|
+
end
|
38
|
+
|
30
39
|
send_tempfile
|
31
40
|
compare_file
|
32
41
|
end
|
@@ -133,6 +142,19 @@ module Itamae
|
|
133
142
|
end
|
134
143
|
end
|
135
144
|
|
145
|
+
def exists_and_not_modified?
|
146
|
+
return false unless current.exist && sha256sum_available?
|
147
|
+
|
148
|
+
current_digest = run_command(["sha256sum", attributes.path]).stdout.split(/\s/, 2).first
|
149
|
+
digest = if content_file
|
150
|
+
Digest::SHA256.file(content_file).hexdigest
|
151
|
+
else
|
152
|
+
Digest::SHA256.hexdigest(attributes.content.to_s)
|
153
|
+
end
|
154
|
+
|
155
|
+
current_digest == digest
|
156
|
+
end
|
157
|
+
|
136
158
|
def show_content_diff
|
137
159
|
if attributes.modified
|
138
160
|
Itamae.logger.info "diff:"
|
@@ -171,7 +193,12 @@ module Itamae
|
|
171
193
|
src = if content_file
|
172
194
|
content_file
|
173
195
|
else
|
174
|
-
f =
|
196
|
+
f =
|
197
|
+
if Gem.win_platform?
|
198
|
+
Tempfile.open('itamae', :mode=>IO::BINARY)
|
199
|
+
else
|
200
|
+
Tempfile.open('itamae')
|
201
|
+
end
|
175
202
|
f.write(attributes.content)
|
176
203
|
f.close
|
177
204
|
f.path
|
@@ -194,6 +221,12 @@ module Itamae
|
|
194
221
|
f.unlink if f
|
195
222
|
end
|
196
223
|
end
|
224
|
+
|
225
|
+
def sha256sum_available?
|
226
|
+
return self.class.sha256sum_available unless self.class.sha256sum_available.nil?
|
227
|
+
|
228
|
+
self.class.sha256sum_available = run_command(["sha256sum", "--version"], error: false).exit_status == 0
|
229
|
+
end
|
197
230
|
end
|
198
231
|
end
|
199
232
|
end
|
data/lib/itamae/resource/git.rb
CHANGED
@@ -84,11 +84,11 @@ module Itamae
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def get_revision(branch)
|
87
|
-
result = run_command_in_repo("git rev-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
run_command_in_repo("git rev-
|
87
|
+
result = run_command_in_repo("git rev-parse #{shell_escape(branch)}", error: false)
|
88
|
+
return result.stdout.strip if result.exit_status == 0
|
89
|
+
|
90
|
+
fetch_origin!
|
91
|
+
run_command_in_repo("git rev-parse #{shell_escape(branch)}").stdout.strip
|
92
92
|
end
|
93
93
|
|
94
94
|
def fetch_origin!
|
@@ -24,6 +24,8 @@ module Itamae
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def action_install(action_options)
|
27
|
+
return if !attributes.version && current.installed
|
28
|
+
|
27
29
|
unless run_specinfra(:check_package_is_installed, attributes.name, attributes.version)
|
28
30
|
run_specinfra(:install_package, attributes.name, attributes.version, attributes.options)
|
29
31
|
updated!
|
@@ -31,7 +33,7 @@ module Itamae
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def action_remove(action_options)
|
34
|
-
if
|
36
|
+
if current.installed
|
35
37
|
run_specinfra(:remove_package, attributes.name, attributes.options)
|
36
38
|
updated!
|
37
39
|
end
|
data/lib/itamae/version.rb
CHANGED
@@ -104,7 +104,7 @@ describe file('/tmp/http_request_headers.html') do
|
|
104
104
|
its(:content) { should match(/"User-Agent":\s*"Itamae"/) }
|
105
105
|
end
|
106
106
|
|
107
|
-
|
107
|
+
xdescribe file('/tmp/http_request_redirect.html') do
|
108
108
|
it { should be_file }
|
109
109
|
its(:content) { should match(/"from":\s*"itamae"/) }
|
110
110
|
end
|
@@ -210,10 +210,10 @@ http_request "/tmp/http_request_headers.html" do
|
|
210
210
|
url "https://httpbin.org/get"
|
211
211
|
end
|
212
212
|
|
213
|
-
http_request "/tmp/http_request_redirect.html" do
|
214
|
-
|
215
|
-
|
216
|
-
end
|
213
|
+
# http_request "/tmp/http_request_redirect.html" do
|
214
|
+
# redirect_limit 1
|
215
|
+
# url "https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org%2Fget%3Ffrom%3Ditamae"
|
216
|
+
# end
|
217
217
|
|
218
218
|
link "/tmp-link" do
|
219
219
|
to "/tmp"
|
@@ -17,38 +17,38 @@ module Itamae
|
|
17
17
|
|
18
18
|
describe ".send_file" do
|
19
19
|
context "the source file doesn't exist" do
|
20
|
-
subject {
|
21
|
-
it { expect
|
20
|
+
subject { itamae_backend.send_file("src", "dst") }
|
21
|
+
it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "The file 'src' doesn't exist.") }
|
22
22
|
end
|
23
23
|
|
24
24
|
context "the source file exist, but it is not a regular file" do
|
25
25
|
before { Dir.mkdir("src") }
|
26
|
-
subject {
|
27
|
-
it { expect
|
26
|
+
subject { itamae_backend.send_file("src", "dst") }
|
27
|
+
it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a file.") }
|
28
28
|
end
|
29
29
|
|
30
30
|
context "the source file is a regular file" do
|
31
31
|
before { FileUtils.touch("src") }
|
32
|
-
subject {
|
32
|
+
subject { itamae_backend.send_file("src", "dst") }
|
33
33
|
it { expect { subject }.not_to raise_error }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe ".send_directory" do
|
38
38
|
context "the source directory doesn't exist" do
|
39
|
-
subject {
|
40
|
-
it { expect
|
39
|
+
subject { itamae_backend.send_directory("src", "dst") }
|
40
|
+
it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "The directory 'src' doesn't exist.") }
|
41
41
|
end
|
42
42
|
|
43
43
|
context "the source directory exist, but it is not a directory" do
|
44
44
|
before { FileUtils.touch("src") }
|
45
|
-
subject {
|
46
|
-
it { expect
|
45
|
+
subject { itamae_backend.send_directory("src", "dst") }
|
46
|
+
it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a directory.") }
|
47
47
|
end
|
48
48
|
|
49
49
|
context "the source directory is a directory" do
|
50
50
|
before { Dir.mkdir("src") }
|
51
|
-
subject {
|
51
|
+
subject { itamae_backend.send_directory("src", "dst") }
|
52
52
|
it { expect { subject }.not_to raise_error }
|
53
53
|
end
|
54
54
|
end
|
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.10.
|
4
|
+
version: 1.10.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-07-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
329
|
- !ruby/object:Gem::Version
|
330
330
|
version: '0'
|
331
331
|
requirements: []
|
332
|
-
rubygems_version: 3.0.
|
332
|
+
rubygems_version: 3.0.3
|
333
333
|
signing_key:
|
334
334
|
specification_version: 4
|
335
335
|
summary: Simple Configuration Management Tool
|