kitchen-salt 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjQxYzczMjEzMzI5OTNiYWMzN2RmNTAxOWMzOGFmYTg4ZWU5NGZmNg==
5
+ data.tar.gz: !binary |-
6
+ MmRmZDZmNzNmZjI5YTJjNTk5NjNhOGY1OWRkZjljNmU2NzY5OGE5Nw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NjNhNzgxZjFiOWFlOGEzMDdjZDQ1YmMyZDY1ZjI2OTAzMGY4MGEwMGFiZmI5
10
+ NjU2YWY0NDM0YTQ3YjM5MDg2NTk3ZWJiYjcxYWY1OTk3M2Q4MWM2ZTE0Mjkw
11
+ ZDQ1Y2YwNGQ4NTI5Y2IyNDA2NTI5NmM1YjU5YTc3N2FkYjE3MWE=
12
+ data.tar.gz: !binary |-
13
+ YmU0MWE0MzBiYjgwZGZmNWFmMTY0MWY1YTNmNjVjY2FlNDFlNDRjNjIxYWQ2
14
+ YmUxY2FiNDk5ZWEyM2QzZGMzMDk1MjQ5MDRlMTQ3MTQwOWEwN2M1YjA3YzRj
15
+ ZmNmMDI0MTExNmJiYTAxOTFkZmE4M2Y2ZTcyZDkxM2U0YzQyMDM=
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Salt
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -35,7 +35,7 @@ module Kitchen
35
35
  default_config :salt_bootstrap_options, ""
36
36
 
37
37
  # alternative method of installing salt
38
- default_config :salt_version, "0.16.2"
38
+ default_config :salt_version, "latest"
39
39
  default_config :salt_apt_repo, "http://apt.mccartney.ie"
40
40
  default_config :salt_apt_repo_key, "http://apt.mccartney.ie/KEY"
41
41
 
@@ -46,10 +46,14 @@ module Kitchen
46
46
  default_config :salt_file_root, "/srv/salt"
47
47
  default_config :salt_pillar_root, "/srv/pillar"
48
48
  default_config :salt_state_top, "/srv/salt/top.sls"
49
+ default_config :state_collection, false
49
50
  default_config :pillars, {}
50
51
  default_config :state_top, {}
51
52
  default_config :salt_run_highstate, true
52
53
 
54
+ # salt-call version that supports the undocumented --retcode-passthrough command
55
+ RETCODE_VERSION = '0.17.5'
56
+
53
57
  def install_command
54
58
  debug(diagnose())
55
59
  salt_install = config[:salt_install]
@@ -89,7 +93,7 @@ module Kitchen
89
93
  then
90
94
  echo "No salt-minion installed and I do not know how to install one!"
91
95
  exit 2
92
- elif [ "${SALT_VERSION}" = "#{salt_version}" ]
96
+ elif [ "${SALT_VERSION}" = "#{salt_version}" -o "#{salt_version}" = "latest" ]
93
97
  then
94
98
  echo "You asked for #{salt_version} and you have already got ${SALT_VERSION} installed, sweet!"
95
99
  elif [ ! -z "${SALT_VERSION}" -a "#{salt_install}" = "bootstrap" ]
@@ -121,7 +125,11 @@ module Kitchen
121
125
  prepare_minion
122
126
  prepare_state_top
123
127
  prepare_pillars
124
- prepare_formula
128
+ if config[:state_collection]
129
+ prepare_state_collection
130
+ else
131
+ prepare_formula
132
+ end
125
133
  end
126
134
 
127
135
  def init_command
@@ -135,8 +143,20 @@ module Kitchen
135
143
  # sudo(File.join(config[:root_path], File.basename(config[:script])))
136
144
  debug(diagnose())
137
145
  if config[:salt_run_highstate]
138
- sudo("salt-call --config-dir=#{File.join(config[:root_path], config[:salt_config])} --local state.highstate")
146
+ cmd = sudo("salt-call --config-dir=#{File.join(config[:root_path], config[:salt_config])} --local state.highstate")
139
147
  end
148
+
149
+ cmd << " --log-level=#{config[:log_level]}"
150
+
151
+ # config[:salt_version] can be 'latest' or 'x.y.z'
152
+ if config[:salt_version] >= RETCODE_VERSION
153
+ debug("Skipping the ropey --retcode-passthrough argument")
154
+ # cmd = cmd + " --retcode-passthrough"
155
+ else
156
+ cmd << " | tee /tmp/salt-call-output ; grep -e ERROR -e CRITICAL /tmp/salt-call-output ; [ $? -eq 0 ] && exit 1 ; [ $? -eq 1 ] && exit 0 "
157
+ end
158
+
159
+ cmd
140
160
  end
141
161
 
142
162
  protected
@@ -247,6 +267,17 @@ module Kitchen
247
267
  FileUtils.cp_r(Dir.glob(File.join(config[:kitchen_root], config[:formula], "*")), formula_dir)
248
268
 
249
269
  end
270
+
271
+ def prepare_state_collection
272
+ info("Preparing state collection (get with it! this should be a formula already!)")
273
+ debug("Using config #{config}")
274
+
275
+ file_root = File.join(sandbox_path, config[:salt_file_root])
276
+ formula_dir = File.join(sandbox_path, config[:salt_file_root], config[:formula])
277
+ FileUtils.mkdir_p(formula_dir)
278
+ FileUtils.cp_r(Dir.glob(File.join(config[:kitchen_root], "*")), formula_dir)
279
+
280
+ end
250
281
  end
251
282
  end
252
283
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-salt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Simon McCartney
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-24 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: salt provisioner for test-kitchen
15
14
  email:
@@ -22,26 +21,25 @@ files:
22
21
  - lib/kitchen/provisioner/salt_solo.rb
23
22
  homepage: https://github.com//kitchen-salt
24
23
  licenses: []
24
+ metadata: {}
25
25
  post_install_message:
26
26
  rdoc_options: []
27
27
  require_paths:
28
28
  - lib
29
29
  required_ruby_version: !ruby/object:Gem::Requirement
30
- none: false
31
30
  requirements:
32
31
  - - ! '>='
33
32
  - !ruby/object:Gem::Version
34
33
  version: '0'
35
34
  required_rubygems_version: !ruby/object:Gem::Requirement
36
- none: false
37
35
  requirements:
38
36
  - - ! '>='
39
37
  - !ruby/object:Gem::Version
40
38
  version: '0'
41
39
  requirements: []
42
40
  rubyforge_project: ! '[none]'
43
- rubygems_version: 1.8.25
41
+ rubygems_version: 2.2.2
44
42
  signing_key:
45
- specification_version: 3
43
+ specification_version: 4
46
44
  summary: salt provisioner for test-kitchen
47
45
  test_files: []