kitchen-salt 0.0.23 → 0.0.24

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: 4af1ecd3dd3d7e2e414f3fd555c10041f2bb2376
4
- data.tar.gz: cc9bcf0c49b3d7ade20601f4801864f1a66a867b
3
+ metadata.gz: 85be745fefb172f73d8e9ee2ae396fe3d508396b
4
+ data.tar.gz: f75956c111096fbe7cc7e724b4712a4dbc9d5fa3
5
5
  SHA512:
6
- metadata.gz: ce92dd6efc00856b7f10f98a31878c83d3e1f7fb3b7f0331bccbec987118a62e57e307eabbe853f1b161eb02664767fdea1e9fdf0b5fe2e054d11681713488c1
7
- data.tar.gz: fff97311e5ade612ee4f1570c4cd3bff9a04ef8cbd1467fe751069116c636f1b8b2b61f492a9fcc857879212f6a95d78a93d1bb2f6f27f0a650f392f8e9620d9
6
+ metadata.gz: ae57f141df5166427ba4cbade9ffe04b3a5fbb0bf9579d4d1822128a3b55ecca3afc51ffd343b831feb412e1f91ec45339c01041f25fba46c3916f95c1276904
7
+ data.tar.gz: 8987519c6d89c2010dee394e96df3f1eb6bba1237c3b8044bd527662c24f0d19aadb1f644825275b615cbac7eee58e0deb824d88f81fad8b3fbee21a400fcb5e
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Salt
3
- VERSION = "0.0.23"
3
+ VERSION = "0.0.24"
4
4
  end
5
5
  end
@@ -47,6 +47,7 @@ module Kitchen
47
47
 
48
48
  default_config :salt_config, "/etc/salt"
49
49
  default_config :salt_minion_config, "/etc/salt/minion"
50
+ default_config :salt_env, "base"
50
51
  default_config :salt_file_root, "/srv/salt"
51
52
  default_config :salt_pillar_root, "/srv/pillar"
52
53
  default_config :salt_state_top, "/srv/salt/top.sls"
@@ -56,6 +57,7 @@ module Kitchen
56
57
  default_config :salt_run_highstate, true
57
58
  default_config :salt_copy_filter, []
58
59
  default_config :is_file_root, false
60
+ default_config :require_chef, true
59
61
 
60
62
  default_config :dependencies, []
61
63
  default_config :vendor_path, nil
@@ -77,7 +79,6 @@ module Kitchen
77
79
  salt_install = config[:salt_install]
78
80
 
79
81
  salt_url = config[:salt_bootstrap_url]
80
- chef_url = config[:chef_bootstrap_url]
81
82
  bootstrap_options = config[:salt_bootstrap_options]
82
83
 
83
84
  salt_version = config[:salt_version]
@@ -85,7 +86,6 @@ module Kitchen
85
86
  salt_apt_repo_key = config[:salt_apt_repo_key]
86
87
  salt_ppa = config[:salt_ppa]
87
88
 
88
- omnibus_download_dir = config[:omnibus_cachier] ? "/tmp/vagrant-cache/omnibus_chef" : "/tmp"
89
89
 
90
90
  <<-INSTALL
91
91
  sh -c '
@@ -101,7 +101,11 @@ module Kitchen
101
101
  #{sudo('sh')} /tmp/bootstrap-salt.sh #{bootstrap_options}
102
102
  elif [ -z "${SALT_VERSION}" -a "#{salt_install}" = "apt" ]
103
103
  then
104
- . /etc/lsb-release
104
+ if [ -z "`which lsb_release`" ]; then
105
+ . /etc/lsb-release
106
+ else
107
+ DISTRIB_CODENAME=`lsb_release -s -c`
108
+ fi
105
109
 
106
110
  echo "-----> Configuring apt repo for salt #{salt_version}"
107
111
  echo "deb #{salt_apt_repo}/salt-#{salt_version} ${DISTRIB_CODENAME} main" | #{sudo('tee')} /etc/apt/sources.list.d/salt-#{salt_version}.list
@@ -148,6 +152,17 @@ module Kitchen
148
152
  exit 2
149
153
  fi
150
154
 
155
+ #{install_chef}
156
+
157
+ '
158
+ INSTALL
159
+ end
160
+
161
+ def install_chef
162
+ return unless config[:require_chef]
163
+ chef_url = config[:chef_bootstrap_url]
164
+ omnibus_download_dir = config[:omnibus_cachier] ? "/tmp/vagrant-cache/omnibus_chef" : "/tmp"
165
+ <<-INSTALL
151
166
  if [ ! -d "/opt/chef" ]
152
167
  then
153
168
  echo "-----> Installing Chef Omnibus (for busser/serverspec ruby support)"
@@ -158,8 +173,6 @@ module Kitchen
158
173
  fi
159
174
  #{sudo('sh')} #{omnibus_download_dir}/install.sh -d #{omnibus_download_dir}
160
175
  fi
161
-
162
- '
163
176
  INSTALL
164
177
  end
165
178
 
@@ -167,7 +180,6 @@ module Kitchen
167
180
  super
168
181
  prepare_data
169
182
  prepare_minion
170
- prepare_state_top
171
183
  prepare_pillars
172
184
  prepare_grains
173
185
 
@@ -192,11 +204,12 @@ module Kitchen
192
204
  raise UserError, "kitchen-salt: Invalid vendor_path set: #{config[:vendor_path]}"
193
205
  end
194
206
  end
207
+ end
195
208
 
196
- config[:dependencies].each do |formula|
197
- prepare_formula formula[:path], formula[:name]
198
- end
209
+ config[:dependencies].each do |formula|
210
+ prepare_formula formula[:path], formula[:name]
199
211
  end
212
+ prepare_state_top
200
213
  end
201
214
 
202
215
  def init_command
@@ -221,22 +234,22 @@ module Kitchen
221
234
  # https://github.com/saltstack/salt/pull/11337
222
235
  # Unless we know we have a version that supports --retcode-passthrough
223
236
  # attempt to scan the output for signs of failure
224
- if config[:salt_version] > RETCODE_VERSION && config[:salt_version] != 'latest'
237
+ if config[:salt_version] > RETCODE_VERSION || config[:salt_version] == 'latest'
225
238
  # hope for the best and hope it works eventually
226
239
  cmd = cmd + " --retcode-passthrough"
240
+ else
241
+ # scan the output for signs of failure, there is a risk of false negatives
242
+ fail_grep = 'grep -e Result.*False -e Data.failed.to.compile -e No.matching.sls.found.for'
243
+ # capture any non-zero exit codes from the salt-call | tee pipe
244
+ cmd = 'set -o pipefail ; ' << cmd
245
+ # Capture the salt-call output & exit code
246
+ cmd << " 2>&1 | tee /tmp/salt-call-output ; SC=$? ; echo salt-call exit code: $SC ;"
247
+ # check the salt-call output for fail messages
248
+ cmd << " (sed '/#{fail_grep}/d' /tmp/salt-call-output | #{fail_grep} ; EC=$? ; echo salt-call output grep exit code ${EC} ;"
249
+ # use the non-zer exit code from salt-call, then invert the results of the grep for failures
250
+ cmd << " [ ${SC} -ne 0 ] && exit ${SC} ; [ ${EC} -eq 0 ] && exit 1 ; [ ${EC} -eq 1 ] && exit 0)"
227
251
  end
228
252
 
229
- # scan the output for signs of failure, there is a risk of false negatives
230
- fail_grep = 'grep -e Result.*False -e Data.failed.to.compile -e No.matching.sls.found.for'
231
- # capture any non-zero exit codes from the salt-call | tee pipe
232
- cmd = 'set -o pipefail ; ' << cmd
233
- # Capture the salt-call output & exit code
234
- cmd << " 2>&1 | tee /tmp/salt-call-output ; SC=$? ; echo salt-call exit code: $SC ;"
235
- # check the salt-call output for fail messages
236
- cmd << " (sed '/#{fail_grep}/d' /tmp/salt-call-output | #{fail_grep} ; EC=$? ; echo salt-call output grep exit code ${EC} ;"
237
- # use the non-zer exit code from salt-call, then invert the results of the grep for failures
238
- cmd << " [ ${SC} -ne 0 ] && exit ${SC} ; [ ${EC} -eq 0 ] && exit 1 ; [ ${EC} -eq 1 ] && exit 0)"
239
-
240
253
  cmd
241
254
  end
242
255
 
@@ -263,11 +276,11 @@ module Kitchen
263
276
  file_client: local
264
277
 
265
278
  file_roots:
266
- base:
279
+ #{config[:salt_env]}:
267
280
  - #{File.join(config[:root_path], config[:salt_file_root])}
268
281
 
269
282
  pillar_roots:
270
- base:
283
+ #{config[:salt_env]}:
271
284
  - #{File.join(config[:root_path], config[:salt_pillar_root])}
272
285
  MINION_CONFIG
273
286
 
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.0.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon McCartney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project: "[none]"
98
- rubygems_version: 2.4.3
98
+ rubygems_version: 2.5.1
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: salt provisioner for test-kitchen