chake 0.90.1 → 0.90.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aea493f81d004a6dbcc2ccb1657dd6705d538512e0d7522d9db7e4a7483846fb
4
- data.tar.gz: e8a6f9c7e034e95f536361b58ce5083d9f3f3d3037d90e82f7d79ff4c8b389e5
3
+ metadata.gz: 693b8b54a375b45d4adcd8ba3bc9b4d67c4a54746767e3dcf4a3df14750a18b9
4
+ data.tar.gz: 6ddd35528575a2b413d3c8e1ebd445bfb9a742c4410eb76062a2848a8b5b06d1
5
5
  SHA512:
6
- metadata.gz: e93294e8a34232bd6e709440f3384223e2171a93a280708568e019dbbcaeeeac75de1d0d933e1ccbfd720a34e835a211bf6f51cd707fe241f0a04e2e44f8700f
7
- data.tar.gz: 04e65daf9f089b5b9a63e2d097c6a178b0362cf433698310cf9858085967ef026ab2c5775f8eb4eb9339298e1c6281062c05b9a59413b59075fdfb378eec286d
6
+ metadata.gz: 254cdfa1778b624204769f8f6ab96dc367d1200a3814809597df64b102d91c47d91659a2854620963702b5251ec1730476da5e40dd7db5e7e0c66a1ec55136ad
7
+ data.tar.gz: 607a924a23f89120fbf7fb97e0f27a80ed3a5b20f001620776498e9a3d7646f4ad01cdb94d159fd405cf22ba1e6f8d810718f69cc20399bf54bf5eedfacbae33
data/.rubocop.yml CHANGED
@@ -53,3 +53,6 @@ Style/SymbolArray:
53
53
 
54
54
  Gemspec/RequiredRubyVersion:
55
55
  Enabled: false
56
+
57
+ Gemspec/DeprecatedAttributeAssignment:
58
+ Enabled: false
data/ChangeLog.md CHANGED
@@ -1,3 +1,17 @@
1
+ # 0.90.3
2
+
3
+ - `itamae_spec`: fix rspec warning about syntax for `expect { }.to raise`
4
+ - bootstrap: `00_set_hostname.sh`: don't set hostname if not needed
5
+ - Chake::Connection: add missing require for `$CHILD_STATUS`
6
+
7
+ # 0.90.2
8
+
9
+ - upload: make sure to reupload on config manager changes
10
+ - Apply suggestions by rubocop 1.39.0
11
+ - Chake::Connection: avoid setting constant inside of block
12
+ - rubocop: keep assignment to `test_files` in the gemspec
13
+ - gemspec: set `spec.metadata['rubygems_mfa_required']`
14
+
1
15
  # 0.90.1
2
16
 
3
17
  * Fix loading node data under ruby < 3.1
data/Rakefile CHANGED
@@ -74,12 +74,10 @@ end
74
74
 
75
75
  desc 'checks if the latest release is properly documented in ChangeLog.md'
76
76
  task :check_changelog do
77
- begin
78
- sh 'grep', "^#\\s*#{pkg.version}", 'ChangeLog.md'
79
- rescue StandardError
80
- puts "Version #{pkg.version} not documented in ChangeLog.md!"
81
- raise
82
- end
77
+ sh 'grep', "^#\\s*#{pkg.version}", 'ChangeLog.md'
78
+ rescue StandardError
79
+ puts "Version #{pkg.version} not documented in ChangeLog.md!"
80
+ raise
83
81
  end
84
82
 
85
83
  desc 'Updates manifest file'
@@ -87,7 +85,7 @@ task :manifest do
87
85
  manifest = File.read('.manifest')
88
86
  git = `git ls-files`
89
87
  if manifest != git
90
- File.open('.manifest', 'w') { |f| f.write(git) }
88
+ File.write('.manifest', git)
91
89
  sh 'git commit .manifest -m "Update manifest"'
92
90
  end
93
91
  end
data/chake.gemspec CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'simplecov'
25
25
 
26
26
  spec.add_dependency 'rake'
27
+ spec.metadata['rubygems_mfa_required'] = 'true'
27
28
  end
@@ -1,7 +1,9 @@
1
1
  hostname="$1"
2
2
 
3
- echo "$hostname" > /etc/hostname
4
- hostname --file /etc/hostname
3
+ if [ "$(hostname)" != "${hostname}" ]; then
4
+ echo "$hostname" > /etc/hostname
5
+ hostname --file /etc/hostname
6
+ fi
5
7
 
6
8
  fqdn=$(hostname --fqdn || true)
7
9
  if [ "$fqdn" != "$hostname" ]; then
data/lib/chake/config.rb CHANGED
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  nodes_file = ENV['CHAKE_NODES'] || 'nodes.yaml'
11
11
  nodes_directory = ENV['CHAKE_NODES_D'] || 'nodes.d'
12
- nodes = File.exist?(nodes_file) && Chake::YAML.load_file(nodes_file) || {}
12
+ nodes = (File.exist?(nodes_file) && Chake::YAML.load_file(nodes_file)) || {}
13
13
  nodes.values.each do |node|
14
14
  node['chake_metadata'] = { 'definition_file' => nodes_file }
15
15
  end
@@ -28,7 +28,7 @@ module Chake
28
28
  end
29
29
 
30
30
  def logging
31
- node.silent && '-l fatal' || ''
31
+ (node.silent && '-l fatal') || ''
32
32
  end
33
33
  end
34
34
  end
@@ -44,7 +44,7 @@ module Chake
44
44
  end
45
45
 
46
46
  def ssh_config
47
- File.exist?(ssh_config_file) && ['-F', ssh_config_file] || []
47
+ (File.exist?(ssh_config_file) && ['-F', ssh_config_file]) || []
48
48
  end
49
49
 
50
50
  def ssh_config_file
@@ -60,11 +60,11 @@ module Chake
60
60
  end
61
61
 
62
62
  def ssh_options
63
- node.port && ['-p', node.port.to_s] || []
63
+ (node.port && ['-p', node.port.to_s]) || []
64
64
  end
65
65
 
66
66
  def scp_options
67
- node.port && ['-P', node.port.to_s] || []
67
+ (node.port && ['-P', node.port.to_s]) || []
68
68
  end
69
69
  end
70
70
  end
@@ -1,5 +1,8 @@
1
+ require 'English'
2
+
1
3
  module Chake
2
- Connection = Struct.new(:node) do
4
+ Connection = Struct.new(:node)
5
+ class Connection
3
6
  class CommandFailed < RuntimeError
4
7
  end
5
8
 
data/lib/chake/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = '0.90.1'.freeze
2
+ VERSION = '0.90.3'.freeze
3
3
  end
data/lib/chake.rb CHANGED
@@ -59,6 +59,7 @@ def if_files_changed(node, group_name, files)
59
59
  return if files.empty?
60
60
 
61
61
  hash_io = IO.popen(%w[xargs sha1sum], 'w+')
62
+ hash_io.puts(File.join(Chake.tmpdir, "#{node}.bootstrap"))
62
63
  files.sort.each { |f| hash_io.puts(f) }
63
64
  hash_io.close_write
64
65
  current_hash = hash_io.read
@@ -69,9 +70,7 @@ def if_files_changed(node, group_name, files)
69
70
 
70
71
  yield if current_hash != hash_on_disk
71
72
  FileUtils.mkdir_p(File.dirname(hash_file))
72
- File.open(hash_file, 'w') do |f|
73
- f.write(current_hash)
74
- end
73
+ File.write(hash_file, current_hash)
75
74
  end
76
75
 
77
76
  def write_json_file(file, data)
@@ -111,9 +110,7 @@ Chake.nodes.each do |node|
111
110
  if !File.exist?(bootstrap_script) || File.read(bootstrap_script) != bootstrap_code
112
111
 
113
112
  # create bootstrap script
114
- File.open(bootstrap_script, 'w') do |f|
115
- f.write(bootstrap_code)
116
- end
113
+ File.write(bootstrap_script, bootstrap_code)
117
114
  chmod 0o755, bootstrap_script
118
115
 
119
116
  # copy bootstrap script over
@@ -131,7 +128,7 @@ Chake.nodes.each do |node|
131
128
  end
132
129
 
133
130
  desc "upload data to #{hostname}"
134
- task "upload:#{hostname}" => :upload_common do
131
+ task "upload:#{hostname}" => ["bootstrap:#{hostname}", :upload_common] do
135
132
  next unless node.needs_upload?
136
133
 
137
134
  encrypted = encrypted_for(hostname)
@@ -142,7 +139,7 @@ Chake.nodes.each do |node|
142
139
  rsync_excludes << '--exclude' << 'local-mode-cache/'
143
140
 
144
141
  rsync = node.rsync + ['-avp'] + ENV.fetch('CHAKE_RSYNC_OPTIONS', '').split
145
- rsync_logging = Rake.application.options.silent && '--quiet' || '--verbose'
142
+ rsync_logging = (Rake.application.options.silent && '--quiet') || '--verbose'
146
143
 
147
144
  hash_files = Dir.glob(File.join(Chake.tmpdir, '*.sha1sum'))
148
145
  files = Dir.glob('**/*').reject { |f| File.directory?(f) } - encrypted.keys - encrypted.values - hash_files
data/man/Rakefile CHANGED
@@ -21,9 +21,9 @@ MANPAGES.each do |man|
21
21
  end
22
22
 
23
23
  task install: MANPAGES do
24
- prefix = ENV['PREFIX'] || File.exist?('debian/rules') && '/usr' || '/usr/local'
25
- man1 = File.join(*[ENV['DESTDIR'], prefix, 'share/man/man1'].compact)
26
- man7 = File.join(*[ENV['DESTDIR'], prefix, 'share/man/man7'].compact)
24
+ prefix = ENV['PREFIX'] || (File.exist?('debian/rules') && '/usr') || '/usr/local'
25
+ man1 = File.join(*[ENV.fetch('DESTDIR', nil), prefix, 'share/man/man1'].compact)
26
+ man7 = File.join(*[ENV.fetch('DESTDIR', nil), prefix, 'share/man/man7'].compact)
27
27
  target = { '.1' => man1, '.7' => man7 }
28
28
  sh 'install', '-d', '-m', '0755', man1
29
29
  sh 'install', '-d', '-m', '0755', man7
@@ -61,7 +61,7 @@ describe Chake::ConfigManager::Itamae do
61
61
 
62
62
  it 'throws an error for unsupported connection' do
63
63
  allow(node).to receive(:connection).and_return(Object.new)
64
- expect(-> { cfg.converge }).to raise_error(NotImplementedError)
64
+ expect { cfg.converge }.to raise_error(NotImplementedError)
65
65
  end
66
66
 
67
67
  it 'handles silent mode' do
@@ -7,8 +7,8 @@ describe 'Chake' do
7
7
 
8
8
  def sh(*args)
9
9
  cmd = Shellwords.join(args)
10
- lib = [Pathname.new(__FILE__).parent.parent / 'lib', ENV['RUBYLIB']].compact.join(':')
11
- path = [Pathname.new(__FILE__).parent.parent / 'bin', ENV['PATH']].join(':')
10
+ lib = [Pathname.new(__FILE__).parent.parent / 'lib', ENV.fetch('RUBYLIB', nil)].compact.join(':')
11
+ path = [Pathname.new(__FILE__).parent.parent / 'bin', ENV.fetch('PATH', nil)].join(':')
12
12
  env = {
13
13
  'RUBYLIB' => lib,
14
14
  'PATH' => path
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.90.1
4
+ version: 0.90.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Terceiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-18 00:00:00.000000000 Z
11
+ date: 2023-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -182,7 +182,8 @@ files:
182
182
  homepage: https://gitlab.com/terceiro/chake
183
183
  licenses:
184
184
  - MIT
185
- metadata: {}
185
+ metadata:
186
+ rubygems_mfa_required: 'true'
186
187
  post_install_message:
187
188
  rdoc_options: []
188
189
  require_paths: