kitchen-salt 0.3.3 → 0.4.0

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: 29cc6593a410ea2483adfc2d2f02f53df4cd81b140a230af23738e97036ae66c
4
- data.tar.gz: de0d4aced4dee05b52088705033f3a2a132f503382293d9b1bd7f3ed36177e96
3
+ metadata.gz: 31ff032a93c1d76d2a38edb9f9074a84aa4eb19bf80ab0744b243d2ef78e2a09
4
+ data.tar.gz: c690d95068e7205c1f53305b11971c92ff73b01b86e3d35e2022770768f3e794
5
5
  SHA512:
6
- metadata.gz: 167647dbc4231e9b55c4dd7258c9238c5fb736bd72c56a3b7db5a481a36cee4163533cab64464ceb9a26dafd343d9ec744888da70b76e03b6b35e33e8d3f8901
7
- data.tar.gz: 12b3b3cc1494dc503ffb361bcab007a52a53c69ba600958d9a089df3d922925a5743e2d8593a5399c7953f49ad82c136985d17e7b1b18a1986ee8bddb73589e5
6
+ metadata.gz: bf0370b1b376923d310a01b1d29482819dcfcba9199075eddceddb4b03c6958754270a40f0d61d811d6f81381f7ee7879b7f8441e9980cb4e72890f592089f9c
7
+ data.tar.gz: bf35ed5e32ae7a0d25cdaeae7947af67920ecc173fcf41052ea61824882fc89154cbb41db09ef9da744f9dcf50859cc6e369bb96694eeba86d13402bb7bd8536
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Salt
3
- VERSION = '0.3.3'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,15 @@
1
+ <%=
2
+ <<-GPGKEY
3
+ sh -c '
4
+ #{Util.shell_helpers}
5
+ # if gpg key exists, install
6
+ echo "Checking for a GPG Key"
7
+ if [ -f "#{config[:root_path]}/gpgkey.txt" ]; then
8
+ echo "Installing \"#{config[:root_path]}/gpgkey.txt\""
9
+ GPGKEY_DIR="#{config[:root_path]}/etc/salt/gpgkeys/"
10
+ mkdir -p "$GPGKEY_DIR"
11
+ chmod 0700 "$GPGKEY_DIR"
12
+ gpg --allow-secret-key-import --no-default-keyring --homedir "$GPGKEY_DIR" --import < "#{config[:root_path]}/gpgkey.txt"
13
+ fi'
14
+ GPGKEY
15
+ %>
@@ -41,6 +41,8 @@ module Kitchen
41
41
  chef_bootstrap_url: 'https://www.chef.io/chef/install.sh',
42
42
  dependencies: [],
43
43
  dry_run: false,
44
+ gpg_home: '~/.gnupg/',
45
+ gpg_key: nil,
44
46
  install_after_init_environment: false,
45
47
  is_file_root: false,
46
48
  local_salt_root: nil,
@@ -192,6 +194,7 @@ module Kitchen
192
194
  def create_sandbox
193
195
  super
194
196
  prepare_data
197
+ prepare_gpg_key
195
198
  prepare_install
196
199
  prepare_minion
197
200
  prepare_pillars
@@ -262,6 +265,7 @@ module Kitchen
262
265
  # install/update dependencies
263
266
  cmd << sudo("chmod +x #{config[:root_path]}/*.sh;")
264
267
  cmd << sudo("#{config[:root_path]}/dependencies.sh;")
268
+ cmd << sudo("#{config[:root_path]}/gpgkey.sh;")
265
269
  salt_config_path = config[:salt_config]
266
270
  salt_call = 'salt-call'
267
271
  end
@@ -317,6 +321,20 @@ module Kitchen
317
321
  cp_r_with_filter(config[:data_path], tmpdata_dir, config[:salt_copy_filter])
318
322
  end
319
323
 
324
+ def prepare_gpg_key
325
+ return unless config[:gpg_key]
326
+
327
+ info('Preparing gpg_key')
328
+ debug("Using gpg key: #{config[:gpg_key]}")
329
+
330
+ system("gpg --homedir #{config[:gpg_home]} -o #{File.join(sandbox_path, 'gpgkey.txt')} --armor --export-secret-keys #{config[:gpg_key]}")
331
+
332
+ gpg_template = File.expand_path('./../gpgkey.erb', __FILE__)
333
+ erb = ERB.new(File.read(gpg_template)).result(binding)
334
+ debug('Install Command:' + erb.to_s)
335
+ write_raw_file(File.join(sandbox_path, 'gpgkey.sh'), erb)
336
+ end
337
+
320
338
  def prepare_minion_base_config
321
339
  if config[:salt_minion_config_template]
322
340
  minion_template = File.expand_path(config[:salt_minion_config_template], Kitchen::Config.new.kitchen_root)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-salt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SaltStack Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-14 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -150,6 +150,7 @@ files:
150
150
  - lib/kitchen/provisioner/99-minion.conf.erb
151
151
  - lib/kitchen/provisioner/dependencies.erb
152
152
  - lib/kitchen/provisioner/formula-fetch.sh
153
+ - lib/kitchen/provisioner/gpgkey.erb
153
154
  - lib/kitchen/provisioner/install.erb
154
155
  - lib/kitchen/provisioner/install_win.erb
155
156
  - lib/kitchen/provisioner/minion.erb