chake 0.80 → 0.81
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/.ackrc +1 -0
- data/.gitlab-ci.yml +1 -1
- data/.manifest +3 -1
- data/.rubocop.yml +2 -0
- data/ChangeLog.md +8 -0
- data/README.md +10 -2
- data/Rakefile +2 -0
- data/lib/chake.rb +26 -3
- data/lib/chake/bootstrap/chef/01_installed.sh +4 -0
- data/lib/chake/bootstrap/chef/{01_debian.sh → 02_debian.sh} +0 -0
- data/lib/chake/config_manager.rb +0 -4
- data/lib/chake/config_manager/itamae.rb +3 -4
- data/lib/chake/node.rb +1 -1
- data/lib/chake/version.rb +1 -1
- data/lib/chake/wipe.rb +18 -0
- data/man/Rakefile +1 -0
- data/spec/chake/config_manager/itamae_spec.rb +23 -5
- data/spec/chake/config_manager_spec.rb +1 -2
- data/spec/spec_helper.rb +18 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b68eda0401a07074704cfd0627f29423cd659a29a048e30afb60eb14c78c7e0
|
4
|
+
data.tar.gz: 031031b2e5bb12c185c974960aa1dd0dd538c31323510f1cb90843c9f7981dca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c7b6ad543209fb895f25b7f436f882731e1bc60880dd66e37a7240ec03bd3608bb99b4fcc8611caf3d9203394389e76f9c6608d8d98242b5119e0ccc87b20f
|
7
|
+
data.tar.gz: 7270ec17c14d6adc02230b57042a1f4585b706761facef2f8118cb1980cd61c8ea87d4899b52232bfa6a8574f31db3bd69287b7178803cd42783164f61f3e3bf
|
data/.ackrc
CHANGED
data/.gitlab-ci.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
image: debian:testing
|
2
2
|
|
3
3
|
.install: &install
|
4
|
-
- apt-get update && apt-get install -qy ruby asciidoctor ruby-bundler ruby-rspec rubocop ruby-simplecov codespell
|
4
|
+
- apt-get update && apt-get install -qy ruby asciidoctor ruby-bundler ruby-rspec rubocop ruby-simplecov codespell ronn
|
5
5
|
|
6
6
|
tests:
|
7
7
|
before_script: *install
|
data/.manifest
CHANGED
@@ -25,7 +25,8 @@ examples/test/cookbooks/example/files/host-lemur/test.asc
|
|
25
25
|
examples/test/cookbooks/example/recipes/default.rb
|
26
26
|
lib/chake.rb
|
27
27
|
lib/chake/bootstrap/00_set_hostname.sh
|
28
|
-
lib/chake/bootstrap/chef/
|
28
|
+
lib/chake/bootstrap/chef/01_installed.sh
|
29
|
+
lib/chake/bootstrap/chef/02_debian.sh
|
29
30
|
lib/chake/bootstrap/chef/99_unsupported.sh
|
30
31
|
lib/chake/config.rb
|
31
32
|
lib/chake/config_manager.rb
|
@@ -49,6 +50,7 @@ lib/chake/node.rb
|
|
49
50
|
lib/chake/readline.rb
|
50
51
|
lib/chake/tmpdir.rb
|
51
52
|
lib/chake/version.rb
|
53
|
+
lib/chake/wipe.rb
|
52
54
|
man/.gitignore
|
53
55
|
man/Rakefile
|
54
56
|
man/readme2man.sed
|
data/.rubocop.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 0.81
|
2
|
+
|
3
|
+
* bootstrap/chef: exit if chef-solo is available
|
4
|
+
* Always bootstrap nodes
|
5
|
+
* Decrypt files in place when upload is not needed
|
6
|
+
* itamae: handle silent mode
|
7
|
+
* manpages: drop accute accent erroneously added by ronn
|
8
|
+
|
1
9
|
# 0.80
|
2
10
|
|
3
11
|
This release adds support for multiple configuration managers. Chef is now only
|
data/README.md
CHANGED
@@ -11,8 +11,8 @@ chake(1) -- serverless configuration management tool
|
|
11
11
|
|
12
12
|
chake is a tool that helps you manage multiple hosts without the need for a
|
13
13
|
central server. Configuration is managed in a local directory, which should
|
14
|
-
(but doesn't need to
|
15
|
-
version control system.
|
14
|
+
(but doesn't need to) be under version control with **git(1)** or any other
|
15
|
+
version control system.
|
16
16
|
|
17
17
|
Configuration is deployed to managed hosts remotely, either by invoking a
|
18
18
|
configuration management tool that will connect to them, or by first uploading
|
@@ -271,6 +271,14 @@ required files to be sent). You can use them to store passwords and other
|
|
271
271
|
sensitive information (SSL keys, etc) in the repository together with the rest
|
272
272
|
of the configuration.
|
273
273
|
|
274
|
+
For configuration managers that don't require uploading files to the managed
|
275
|
+
node, this decryption will happen right before converging or applying single
|
276
|
+
recipes, and the decrypted files will be wiped right after that.
|
277
|
+
|
278
|
+
If you use this feature, make sure that you have the `wipe` program installed.
|
279
|
+
This way chake will be able to delete the decrypted files in a slightly more
|
280
|
+
secure way, after being done with them.
|
281
|
+
|
274
282
|
### repository-local SSH configuration
|
275
283
|
|
276
284
|
If you need special SSH configuration parameters, you can create a file called
|
data/Rakefile
CHANGED
data/lib/chake.rb
CHANGED
@@ -5,6 +5,7 @@ require 'tmpdir'
|
|
5
5
|
require 'chake/config'
|
6
6
|
require 'chake/version'
|
7
7
|
require 'chake/readline'
|
8
|
+
require 'chake/wipe'
|
8
9
|
|
9
10
|
desc 'Initializes current directory with sample structure'
|
10
11
|
task init: 'init:itamae'
|
@@ -34,6 +35,24 @@ def encrypted_for(node)
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
38
|
+
def maybe_decrypt(node)
|
39
|
+
if node.needs_upload?
|
40
|
+
return yield
|
41
|
+
end
|
42
|
+
|
43
|
+
files = encrypted_for(node.hostname)
|
44
|
+
files.each do |encrypted, target|
|
45
|
+
sh "gpg --use-agent --quiet --decrypt --output #{target} #{encrypted}"
|
46
|
+
end
|
47
|
+
begin
|
48
|
+
yield
|
49
|
+
ensure
|
50
|
+
files.each do |_, target|
|
51
|
+
Chake::Wipe.instance.wipe(target)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
37
56
|
def if_files_changed(node, group_name, files)
|
38
57
|
return if files.empty?
|
39
58
|
|
@@ -87,7 +106,7 @@ Chake.nodes.each do |node|
|
|
87
106
|
desc "bootstrap #{hostname}"
|
88
107
|
task "bootstrap:#{hostname}" => :bootstrap_common do
|
89
108
|
mkdir_p Chake.tmpdir unless File.directory?(Chake.tmpdir)
|
90
|
-
if
|
109
|
+
if !File.exist?(bootstrap_script) || File.read(bootstrap_script) != bootstrap_code
|
91
110
|
|
92
111
|
# create bootstrap script
|
93
112
|
File.open(bootstrap_script, 'w') do |f|
|
@@ -151,12 +170,16 @@ Chake.nodes.each do |node|
|
|
151
170
|
|
152
171
|
desc "converge #{hostname}"
|
153
172
|
task "converge:#{hostname}" => converge_dependencies do
|
154
|
-
node
|
173
|
+
maybe_decrypt(node) do
|
174
|
+
node.converge
|
175
|
+
end
|
155
176
|
end
|
156
177
|
|
157
178
|
desc 'apply <recipe> on #{hostname}'
|
158
179
|
task "apply:#{hostname}", [:recipe] => %i[recipe_input connect_common] do |_task, _args|
|
159
|
-
node
|
180
|
+
maybe_decrypt(node) do
|
181
|
+
node.apply($recipe_to_apply)
|
182
|
+
end
|
160
183
|
end
|
161
184
|
task "apply:#{hostname}" => converge_dependencies
|
162
185
|
|
File without changes
|
data/lib/chake/config_manager.rb
CHANGED
@@ -13,10 +13,6 @@ module Chake
|
|
13
13
|
run_itamae(config)
|
14
14
|
end
|
15
15
|
|
16
|
-
def needs_bootstrap?
|
17
|
-
false
|
18
|
-
end
|
19
|
-
|
20
16
|
def needs_upload?
|
21
17
|
false
|
22
18
|
end
|
@@ -39,6 +35,9 @@ module Chake
|
|
39
35
|
raise NotImplementedError, "Connection type #{node.connection.class} not supported for itamee"
|
40
36
|
end
|
41
37
|
cmd << "--node-json=#{json_config}"
|
38
|
+
if node.silent
|
39
|
+
cmd << '--log-level=warn'
|
40
|
+
end
|
42
41
|
cmd += recipes
|
43
42
|
node.log("$ #{cmd.join(' ')}")
|
44
43
|
io = IO.popen(cmd, 'r', err: %i[child out])
|
data/lib/chake/node.rb
CHANGED
@@ -43,7 +43,7 @@ module Chake
|
|
43
43
|
@config_manager ||= Chake::ConfigManager.get(self)
|
44
44
|
end
|
45
45
|
|
46
|
-
def_delegators :config_manager, :converge, :apply, :path, :bootstrap_steps, :
|
46
|
+
def_delegators :config_manager, :converge, :apply, :path, :bootstrap_steps, :needs_upload?
|
47
47
|
|
48
48
|
def path
|
49
49
|
@path ||= config_manager.path
|
data/lib/chake/version.rb
CHANGED
data/lib/chake/wipe.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module Chake
|
4
|
+
class Wipe
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
if system('which', 'wipe', out: '/dev/null', err: :out)
|
8
|
+
def wipe(file)
|
9
|
+
system('wipe', '-rfs', file)
|
10
|
+
end
|
11
|
+
else
|
12
|
+
warn 'W: please install "wipe" program for secure deletion, falling back to unlink(2)'
|
13
|
+
def wipe(file)
|
14
|
+
File.unlink(file)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/man/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'chake/node'
|
2
3
|
require 'chake/config_manager/itamae'
|
3
4
|
|
@@ -12,10 +13,6 @@ describe Chake::ConfigManager::Itamae do
|
|
12
13
|
let(:cfg) { Chake::ConfigManager::Itamae.new(node) }
|
13
14
|
let(:output) { StringIO.new("line1\nline2\n") }
|
14
15
|
|
15
|
-
it 'does not require bootstrapping' do
|
16
|
-
expect(cfg.needs_bootstrap?).to eq(false)
|
17
|
-
end
|
18
|
-
|
19
16
|
it 'does not require uploading' do
|
20
17
|
expect(cfg.needs_upload?).to eq(false)
|
21
18
|
end
|
@@ -54,7 +51,7 @@ describe Chake::ConfigManager::Itamae do
|
|
54
51
|
let(:hostname) { 'local://localhostname' }
|
55
52
|
it 'calls itamae with local subcommand' do
|
56
53
|
expect(IO).to receive(:popen).with(
|
57
|
-
|
54
|
+
array_including('itamae', 'local', /--node-json=.*/, 'foo.rb', 'bar.rb'),
|
58
55
|
anything,
|
59
56
|
err: anything
|
60
57
|
).and_return(output)
|
@@ -66,4 +63,25 @@ describe Chake::ConfigManager::Itamae do
|
|
66
63
|
allow(node).to receive(:connection).and_return(Object.new)
|
67
64
|
expect(-> { cfg.converge }).to raise_error(NotImplementedError)
|
68
65
|
end
|
66
|
+
|
67
|
+
it 'handles silent mode' do
|
68
|
+
expect(IO).to receive(:popen).with(
|
69
|
+
array_including('--log-level=warn'),
|
70
|
+
anything,
|
71
|
+
err: anything
|
72
|
+
).and_return(output)
|
73
|
+
cfg.converge
|
74
|
+
end
|
75
|
+
|
76
|
+
RSpec::Matchers.define_negated_matcher :array_excluding, :include
|
77
|
+
|
78
|
+
it 'handles non-silent mode' do
|
79
|
+
node.silent = false
|
80
|
+
expect(IO).to receive(:popen).with(
|
81
|
+
array_excluding('--log-level=warn'),
|
82
|
+
anything,
|
83
|
+
err: anything
|
84
|
+
).and_return(output)
|
85
|
+
silence($stdout) { cfg.converge }
|
86
|
+
end
|
69
87
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -44,3 +44,21 @@ shared_examples 'Chake::Connection' do |connection_class|
|
|
44
44
|
connection.run_as_root('something')
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
module Helpers
|
49
|
+
def silence(stream)
|
50
|
+
orig_stream = stream.clone
|
51
|
+
begin
|
52
|
+
File.open('/dev/null', 'w') do |f|
|
53
|
+
stream.reopen(f)
|
54
|
+
yield
|
55
|
+
end
|
56
|
+
ensure
|
57
|
+
stream.reopen(orig_stream)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
RSpec.configure do |c|
|
63
|
+
c.include Helpers
|
64
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.81'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antonio Terceiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,7 +133,8 @@ files:
|
|
133
133
|
- examples/test/cookbooks/example/recipes/default.rb
|
134
134
|
- lib/chake.rb
|
135
135
|
- lib/chake/bootstrap/00_set_hostname.sh
|
136
|
-
- lib/chake/bootstrap/chef/
|
136
|
+
- lib/chake/bootstrap/chef/01_installed.sh
|
137
|
+
- lib/chake/bootstrap/chef/02_debian.sh
|
137
138
|
- lib/chake/bootstrap/chef/99_unsupported.sh
|
138
139
|
- lib/chake/config.rb
|
139
140
|
- lib/chake/config_manager.rb
|
@@ -157,6 +158,7 @@ files:
|
|
157
158
|
- lib/chake/readline.rb
|
158
159
|
- lib/chake/tmpdir.rb
|
159
160
|
- lib/chake/version.rb
|
161
|
+
- lib/chake/wipe.rb
|
160
162
|
- man/.gitignore
|
161
163
|
- man/Rakefile
|
162
164
|
- man/readme2man.sed
|