kitchen-salt 0.4.1 → 0.5.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
  SHA1:
3
- metadata.gz: 90801c5a0ac6861667789c0f422110363806d1f2
4
- data.tar.gz: 352badb1b9702f53ecd314cfd5779b4bf7f3f361
3
+ metadata.gz: a46966eced8d8a45e75f0aea932a70a6cd20e047
4
+ data.tar.gz: 36024fd5cd393cc06230d00324cd5d49e9197d6a
5
5
  SHA512:
6
- metadata.gz: a91546dd9201fb63503475db3d7aef5d0ccb97846db2e823888d09b3feb61d3f25c97be6178fa544c9bbb1d9a607bec5c21ca86702684ecdede0cb5c372dd1f8
7
- data.tar.gz: ed3777689beef0dbfde59a821ea2a55f3e1e65e3bc99d9e5c7f67e9ba9a08914ba5c078973a82baebe289d1d1461510fdb33bf38755111e4d18d5e0cb3b475ec
6
+ metadata.gz: a5320882718483c44989b8a42c61cc9d7ba36ba82f4254fc117e52cbebe3d5965f5bd535a3fcd8dcc3559ff8520bf3d9d4a4671a3ada3d88f14af266b2a0006d
7
+ data.tar.gz: 4124bd733b736bec1d09c9df5ea9ae43c58532066514a2ddf4ffe4fe6dc7c844414f2530dc6fb35c298054b6152556b17511d50a3a4f582f9051370bcb67e20e
@@ -55,6 +55,12 @@ module Kitchen
55
55
  end
56
56
  end
57
57
 
58
+ def salt_call
59
+ return config[:salt_call_command] if config[:salt_call_command]
60
+ return 'c:\\salt\\salt-call.bat' if windows_os?
61
+ 'salt-call'
62
+ end
63
+
58
64
  def write_raw_file(name, contents)
59
65
  FileUtils.mkdir_p(File.dirname(name))
60
66
  File.open(name, 'wb') do |file|
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Salt
3
- VERSION = '0.4.1'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
@@ -24,7 +24,7 @@ sh -c '
24
24
  #{Util.shell_helpers}
25
25
 
26
26
  # what version of salt is installed?
27
- command -v salt-call >/dev/null 2>&1 && SALT_VERSION=$(salt-call --version|cut -d " " -f 2)
27
+ command -v #{salt_call} >/dev/null 2>&1 && SALT_VERSION=$(#{salt_call} --version|cut -d " " -f 2)
28
28
  command -v locale-gen >/dev/null 2>&1 && #{sudo('locale-gen')} en_US.UTF-8
29
29
  set +x
30
30
  export DEBIAN_FRONTEND=noninteractive
@@ -98,7 +98,7 @@ EOL
98
98
  fi
99
99
 
100
100
  # check again, now that an install of some form should have happened
101
- command -v salt-call >/dev/null 2>&1 && FULL_SALT_VERSION=$(salt-call --version|cut -d " " -f 2)
101
+ command -v #{salt_call} >/dev/null 2>&1 && FULL_SALT_VERSION=$(#{salt_call} --version|cut -d " " -f 2)
102
102
 
103
103
  # extract short format of Salt version
104
104
  if [ ! -z "${FULL_SALT_VERSION}" ]
@@ -1,21 +1,22 @@
1
1
  <%=
2
2
  salt_install = config[:salt_install]
3
3
  salt_url = config[:salt_bootstrap_url]
4
- bootstrap_options = config[:salt_bootstrap_options]
5
4
  salt_version = config[:salt_version]
5
+ bootstrap_options = config[:salt_bootstrap_options] % [salt_version]
6
6
 
7
7
  <<-POWERSHELL
8
- if (Test-Path c:\\salt\\salt-call.bat) {
9
- $installed_version = $(c:\\salt\\salt-call.bat --version).split(' ')[1]
8
+ if (Test-Path #{salt_call}) {
9
+ $installed_version = $(#{salt_call} --version).split(' ')[1]
10
10
  }
11
11
  if (-Not $(Test-Path c:\\temp)) {
12
12
  New-Item -Path c:\\temp -itemtype directory
13
13
  }
14
14
  if (-Not $installed_version -And "#{salt_install}" -eq "bootstrap") {
15
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
15
16
  (New-Object net.webclient).DownloadFile("#{salt_url}", "c:\\temp\\salt_bootstrap.ps1")
16
17
  #{sudo('powershell')} c:\\temp\\salt_bootstrap.ps1 #{bootstrap_options}
17
18
  }
18
- $FULL_SALT_VERSION = $(c:\\salt\\salt-call.bat --version).split(' ')[1]
19
+ $FULL_SALT_VERSION = $(#{salt_call} --version).split(' ')[1]
19
20
  if ($FULL_SALT_VERSION) {
20
21
  $YEAR = $FULL_SALT_VERSION.split('.')[0]
21
22
  $MONTH = $FULL_SALT_VERSION.split('.')[1]
@@ -83,7 +83,8 @@ module Kitchen
83
83
  state_top_from_file: false,
84
84
  state_top: {},
85
85
  vendor_path: nil,
86
- vendor_repo: {}
86
+ vendor_repo: {},
87
+ run_salt_call: true
87
88
  }.freeze
88
89
 
89
90
  WIN_DEFAULT_CONFIG = {
@@ -258,16 +259,14 @@ module Kitchen
258
259
 
259
260
  cmd = ''
260
261
  if windows_os?
261
- salt_call = "c:\\salt\\salt-call.bat"
262
262
  salt_config_path = config[:salt_config]
263
263
  cmd << "(get-content #{os_join(config[:root_path], salt_config_path, 'minion')}) -replace '\\$env:TEMP', $env:TEMP | set-content #{os_join(config[:root_path], salt_config_path, 'minion')} ;"
264
264
  else
265
265
  # install/update dependencies
266
266
  cmd << sudo("chmod +x #{config[:root_path]}/*.sh;")
267
267
  cmd << sudo("#{config[:root_path]}/dependencies.sh;")
268
- cmd << sudo("#{config[:root_path]}/gpgkey.sh;")
268
+ cmd << sudo("#{config[:root_path]}/gpgkey.sh;") if config[:gpg_key]
269
269
  salt_config_path = config[:salt_config]
270
- salt_call = 'salt-call'
271
270
  end
272
271
  cmd << sudo("#{salt_call} --state-output=changes --config-dir=#{os_join(config[:root_path], salt_config_path)} state.highstate")
273
272
  cmd << " --log-level=#{config[:log_level]}" if config[:log_level]
@@ -286,6 +285,8 @@ module Kitchen
286
285
  debug("running driver #{name}")
287
286
  debug(diagnose)
288
287
 
288
+ return unless config[:run_salt_call]
289
+
289
290
  # config[:salt_version] can be 'latest' or 'x.y.z', 'YYYY.M.x' etc
290
291
  # error return codes are a mess in salt:
291
292
  # https://github.com/saltstack/salt/pull/11337
@@ -453,7 +454,6 @@ module Kitchen
453
454
  instance_variables.each {|var| hash[var[1..-1]] = instance_variable_get(var) }
454
455
  hash.map{|k,v| [k.to_s.to_sym,v]}.to_h
455
456
  end
456
-
457
457
  end
458
458
  end
459
459
  end
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.4.1
4
+ version: 0.5.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: 2019-01-23 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie