chake 0.90.3 → 0.92

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
  SHA256:
3
- metadata.gz: 693b8b54a375b45d4adcd8ba3bc9b4d67c4a54746767e3dcf4a3df14750a18b9
4
- data.tar.gz: 6ddd35528575a2b413d3c8e1ebd445bfb9a742c4410eb76062a2848a8b5b06d1
3
+ metadata.gz: 796da031fd0926e8f4a2ba13a949dc6b308d0ceb811a8568db08a5ca54f99a07
4
+ data.tar.gz: ab0c285bbbe3a7e8ce6b665ac63de976c4a6239ebc2e356ec7f8ded4caaa0f3a
5
5
  SHA512:
6
- metadata.gz: 254cdfa1778b624204769f8f6ab96dc367d1200a3814809597df64b102d91c47d91659a2854620963702b5251ec1730476da5e40dd7db5e7e0c66a1ec55136ad
7
- data.tar.gz: 607a924a23f89120fbf7fb97e0f27a80ed3a5b20f001620776498e9a3d7646f4ad01cdb94d159fd405cf22ba1e6f8d810718f69cc20399bf54bf5eedfacbae33
6
+ metadata.gz: 2f8ee4d755b3beb84e101c694823e685ce121ec4b26183b0048db91da7d5ced6fcda624fc29cd96f6e111aa28d6e4a4b13e145d7f5887bf59032b3c1db868691
7
+ data.tar.gz: 0320fe56feaf9a4c8e514cbf33cfff46cd24f68daa88ab6c74e88ab475d8e4c13b0ac7477a463a28478aa38cad55dd588cfbe028ff1315fd62c1baf71d8e5bbb
data/.manifest CHANGED
@@ -13,6 +13,7 @@ README.itamae.md
13
13
  README.md
14
14
  README.shell.md
15
15
  Rakefile
16
+ activate.sh
16
17
  bin/chake
17
18
  chake.gemspec
18
19
  chake.spec.erb
data/ChangeLog.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 0.92
2
+
3
+ - Add support for connect:$HOST hooks
4
+
5
+ # 0.91
6
+
7
+ - itamae: handle empty recipe list
8
+ - Add support for configuring encrypted files explicitly
9
+ - itamae-remote: handle empty recipe list
10
+ - Rakefile: deb:install: install dependencies as well
11
+ - activate.sh: add script to use this source dir in a shell
12
+ - Make rsync invocations quiet by default
13
+
1
14
  # 0.90.3
2
15
 
3
16
  - `itamae_spec`: fix rspec warning about syntax for `expect { }.to raise`
data/README.md CHANGED
@@ -254,6 +254,8 @@ converging. To do this, you just need to enhance the corresponding tasks:
254
254
  * `connect_common`: executed before doing any action that connects to any of
255
255
  the hosts. This can be used for example to generate a ssh configuration file
256
256
  based on the contents of the nodes definition files.
257
+ * `connect:HOSTNAME`: executed before doing any action that connects to
258
+ `HOSTNAME`.
257
259
 
258
260
  Example:
259
261
 
@@ -265,9 +267,28 @@ end
265
267
 
266
268
  ### Encrypted files
267
269
 
268
- Any files ending matching `*.gpg` and `*.asc` will be decrypted with GnuPG
269
- before being sent to the node (for the configuration management tools that
270
- required files to be sent). You can use them to store passwords and other
270
+ `chake` supports encrypted files matching either `\*.gpg` or `\*.asc`. There are
271
+ two ways of specicying per-host encrypted files:
272
+
273
+ 1. listing them in the `encrypted` attribute in the node configuration file.
274
+ Example:
275
+
276
+ ```yaml
277
+ host1.mycompany.com:
278
+ itamae:
279
+ - roles/basic.rb
280
+ encrypted:
281
+ - foo.txt.asc
282
+ ```
283
+ 2. (deprecated) any files matching
284
+ `\*\*/files/{default,host-#{node}}/\*.{asc,gpg}` and
285
+ `\*\*/files/\*.{asc,gpg}`, **if** `encrypted` is not defined in the node
286
+ configuration.
287
+
288
+
289
+ They will be decrypted with GnuPG before being sent to the node (for the
290
+ configuration management tools that required files to be sent), without the
291
+ `\*.asc` or `\*.gpg` extension. You can use them to store passwords and other
271
292
  sensitive information (SSL keys, etc) in the repository together with the rest
272
293
  of the configuration.
273
294
 
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ desc 'Builds and installs Debian package'
36
36
  task 'deb:install' => 'build:debsrc' do
37
37
  chdir "pkg/#{pkg.name}-#{pkg.version}" do
38
38
  sh 'dpkg-buildpackage --diff-ignore=version.rb -us -uc'
39
- sh 'debi'
39
+ sh 'sudo apt-get install -qy --reinstall $(debc --list-debs)'
40
40
  end
41
41
  end
42
42
 
@@ -100,7 +100,7 @@ end
100
100
 
101
101
  desc 'Check spelling in the source code'
102
102
  task :codespell do
103
- sh 'codespell', '--skip=.git', '--skip=coverage', '--skip=*.asc', '--skip=*.swp', '--skip=tags'
103
+ sh 'codespell', '--skip=.git', '--skip=coverage', '--skip=*.asc', '--skip=*.swp', '--skip=tags', '--skip=*.1'
104
104
  end
105
105
 
106
106
  task default: [:test, :style, :codespell]
data/activate.sh ADDED
@@ -0,0 +1,3 @@
1
+ base=$(dirname $BASH_SOURCE)
2
+ export RUBYLIB=${base}/lib:${RUBYLIB}
3
+ export PATH=${base}/bin:${PATH}
data/bin/chake CHANGED
@@ -16,7 +16,7 @@ if rakefiles.none? { |f| File.exist?(f) } && !ARGV.include?('-f') && !ARGV.inclu
16
16
  end
17
17
  ARGV.unshift << '--rakefile' << rakefile
18
18
 
19
- # clenup after finishing
19
+ # cleanup after finishing
20
20
  at_exit do
21
21
  FileUtils.rm_rf tmpdir
22
22
  end
@@ -6,7 +6,10 @@ module Chake
6
6
  class ConfigManager
7
7
  class Itamae < ConfigManager
8
8
  def converge
9
- run_itamae(*node.data['itamae'])
9
+ recipes = node.data['itamae']
10
+ return if recipes.empty?
11
+
12
+ run_itamae(*recipes)
10
13
  end
11
14
 
12
15
  def apply(config)
@@ -6,7 +6,10 @@ module Chake
6
6
  class ConfigManager
7
7
  class ItamaeRemote < ConfigManager
8
8
  def converge
9
- run_itamae(*node.data['itamae-remote'])
9
+ recipes = node.data['itamae-remote']
10
+ return if recipes.empty?
11
+
12
+ run_itamae(*recipes)
10
13
  end
11
14
 
12
15
  def apply(config)
data/lib/chake/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = '0.90.3'.freeze
2
+ VERSION = '0.92'.freeze
3
3
  end
data/lib/chake.rb CHANGED
@@ -31,18 +31,28 @@ task :nodes do
31
31
  end
32
32
 
33
33
  def encrypted_for(node)
34
- encrypted_files = Dir.glob("**/files/{default,host-#{node}}/*.{asc,gpg}") + Dir.glob('**/files/*.{asc,gpg}')
34
+ encrypted_files = Array(node.data['encrypted'])
35
+ if encrypted_files.empty?
36
+ encrypted_files = Dir.glob("**/files/{default,host-#{node.hostname}}/*.{asc,gpg}") + Dir.glob('**/files/*.{asc,gpg}')
37
+ end
35
38
  encrypted_files.each_with_object({}) do |key, hash|
36
39
  hash[key] = key.sub(/\.(asc|gpg)$/, '')
37
40
  end
38
41
  end
39
42
 
43
+ desc 'list encrypted files per node'
44
+ task :encrypted do
45
+ Chake.nodes.each do |node|
46
+ puts "#{node.hostname}: #{Array(encrypted_for(node).keys).join(', ')}"
47
+ end
48
+ end
49
+
40
50
  def maybe_decrypt(node)
41
51
  if node.needs_upload?
42
52
  return yield
43
53
  end
44
54
 
45
- files = encrypted_for(node.hostname)
55
+ files = encrypted_for(node)
46
56
  files.each do |encrypted, target|
47
57
  sh "gpg --use-agent --quiet --decrypt --output #{target} #{encrypted}"
48
58
  end
@@ -131,15 +141,15 @@ Chake.nodes.each do |node|
131
141
  task "upload:#{hostname}" => ["bootstrap:#{hostname}", :upload_common] do
132
142
  next unless node.needs_upload?
133
143
 
134
- encrypted = encrypted_for(hostname)
144
+ encrypted = encrypted_for(node)
135
145
  rsync_excludes = (encrypted.values + encrypted.keys).map { |f| ['--exclude', f] }.flatten
136
146
  rsync_excludes << '--exclude' << '.git/'
137
147
  rsync_excludes << '--exclude' << 'cache/'
138
148
  rsync_excludes << '--exclude' << 'nodes/'
139
149
  rsync_excludes << '--exclude' << 'local-mode-cache/'
140
150
 
141
- rsync = node.rsync + ['-avp'] + ENV.fetch('CHAKE_RSYNC_OPTIONS', '').split
142
- rsync_logging = (Rake.application.options.silent && '--quiet') || '--verbose'
151
+ rsync = node.rsync + ['-ap'] + ENV.fetch('CHAKE_RSYNC_OPTIONS', '').split
152
+ rsync_logging = (Rake.application.options.trace && '--verbose') || '--quiet'
143
153
 
144
154
  hash_files = Dir.glob(File.join(Chake.tmpdir, '*.sha1sum'))
145
155
  files = Dir.glob('**/*').reject { |f| File.directory?(f) } - encrypted.keys - encrypted.values - hash_files
@@ -175,7 +185,7 @@ Chake.nodes.each do |node|
175
185
  end
176
186
 
177
187
  desc 'apply <recipe> on #{hostname}'
178
- task "apply:#{hostname}", [:recipe] => %i[recipe_input connect_common] do |_task, _args|
188
+ task "apply:#{hostname}", [:recipe] => [:recipe_input, :connect_common, "connect:#{hostname}"] do |_task, _args|
179
189
  maybe_decrypt(node) do
180
190
  node.apply($recipe_to_apply)
181
191
  end
@@ -183,19 +193,22 @@ Chake.nodes.each do |node|
183
193
  task "apply:#{hostname}" => converge_dependencies
184
194
 
185
195
  desc "run a command on #{hostname}"
186
- task "run:#{hostname}", [:command] => %i[run_input connect_common] do
196
+ task "run:#{hostname}", [:command] => [:run_input, :connect_common, "connect:#{hostname}"] do
187
197
  node.run($cmd_to_run)
188
198
  end
189
199
 
190
200
  desc "Logs in to a shell on #{hostname}"
191
- task "login:#{hostname}" => :connect_common do
201
+ task "login:#{hostname}" => [:connect_common, "connect:#{hostname}"] do
192
202
  node.run_shell
193
203
  end
194
204
 
195
205
  desc 'checks connectivity and setup on all nodes'
196
- task "check:#{hostname}" => :connect_common do
206
+ task "check:#{hostname}" => [:connect_common, "connect:#{hostname}"] do
197
207
  node.run('sudo echo OK')
198
208
  end
209
+
210
+ # needs to be overridden in user projects
211
+ task "connect:#{hostname}"
199
212
  end
200
213
 
201
214
  task :run_input, :command do |_task, args|
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.90.3
4
+ version: '0.92'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Terceiro
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-09-02 00:00:00.000000000 Z
10
+ date: 2025-02-21 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -121,6 +120,7 @@ files:
121
120
  - README.md
122
121
  - README.shell.md
123
122
  - Rakefile
123
+ - activate.sh
124
124
  - bin/chake
125
125
  - chake.gemspec
126
126
  - chake.spec.erb
@@ -184,7 +184,6 @@ licenses:
184
184
  - MIT
185
185
  metadata:
186
186
  rubygems_mfa_required: 'true'
187
- post_install_message:
188
187
  rdoc_options: []
189
188
  require_paths:
190
189
  - lib
@@ -199,8 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
198
  - !ruby/object:Gem::Version
200
199
  version: '0'
201
200
  requirements: []
202
- rubygems_version: 3.3.15
203
- signing_key:
201
+ rubygems_version: 3.6.3
204
202
  specification_version: 4
205
203
  summary: serverless configuration management tool for chef
206
204
  test_files: