kitchen-dsc 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/kitchen-dsc.gemspec +8 -8
- data/lib/kitchen/provisioner/dsc.rb +37 -20
- data/lib/kitchen-dsc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db8e9466934c88648b2716777580c81c8ac81f81
|
4
|
+
data.tar.gz: f9fdb9ac31e4ca3a375d76f9703aefec4091efeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cd11a166f9c02099d9616e97b310c9be11b458687465f7bb42d379f2fe5964e19c148bdc2de1264c086417a0ea1d72ea118a0f73372d78bcc5dff3586edafe6
|
7
|
+
data.tar.gz: 04071da119ed739ef0cc4dffba8cc374102447b5fdaee609039074db00a4a51b7e0ebf87623a7642aa046162a871e4cd63be30b41a6671fe348bb9b95b44c618
|
data/README.md
CHANGED
@@ -62,6 +62,13 @@ You will see a delay in the return of the run details due to an difference in ho
|
|
62
62
|
* Requires WMF 5
|
63
63
|
* Takes a string (for one module) or an array (for multiple) to install from the gallery
|
64
64
|
|
65
|
+
* gallery_name
|
66
|
+
* Custom PowerShell gallery name to install modules from.
|
67
|
+
* If there is no package source with this name registered on the machine, then gallery_uri must be configured as well.
|
68
|
+
|
69
|
+
* gallery_uri
|
70
|
+
* URI for a custom PowerShell gallery feed.
|
71
|
+
|
65
72
|
### Specific to repository style testing
|
66
73
|
* modules_path
|
67
74
|
* Defaults to 'modules'.
|
data/kitchen-dsc.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.name = 'kitchen-dsc'
|
8
8
|
s.version = Kitchen::Dsc::VERSION
|
9
9
|
s.authors = ['Steven Murawski']
|
10
|
-
s.email = ['
|
10
|
+
s.email = ['smurawski@chef.io']
|
11
11
|
s.homepage = 'https://github.com/test-kitchen/kitchen-dsc'
|
12
12
|
s.summary = 'PowerShell DSC provisioner for test-kitchen'
|
13
13
|
candidates = Dir.glob('lib/**/*') + ['README.md', 'kitchen-dsc.gemspec']
|
@@ -26,16 +26,16 @@ DSC Provisioner for Test Kitchen
|
|
26
26
|
TBD
|
27
27
|
|
28
28
|
EOF
|
29
|
-
s.add_dependency
|
29
|
+
s.add_dependency 'test-kitchen', '~> 1.4'
|
30
30
|
|
31
|
-
s.add_development_dependency
|
32
|
-
s.add_development_dependency
|
33
|
-
s.add_development_dependency
|
34
|
-
s.add_development_dependency
|
31
|
+
s.add_development_dependency 'countloc', '~> 0.4'
|
32
|
+
s.add_development_dependency 'rake'
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.2'
|
34
|
+
s.add_development_dependency 'simplecov', '~> 0.9'
|
35
35
|
|
36
36
|
# style and complexity libraries are tightly version pinned as newer releases
|
37
37
|
# may introduce new and undesireable style choices which would be immediately
|
38
38
|
# enforced in CI
|
39
|
-
s.add_development_dependency
|
40
|
-
s.add_development_dependency
|
39
|
+
s.add_development_dependency 'finstyle', '1.4.0'
|
40
|
+
s.add_development_dependency 'cane', '2.6.2'
|
41
41
|
end
|
@@ -13,7 +13,6 @@ require 'kitchen/provisioner/base'
|
|
13
13
|
require 'kitchen/util'
|
14
14
|
|
15
15
|
module Kitchen
|
16
|
-
|
17
16
|
module Provisioner
|
18
17
|
class Dsc < Base
|
19
18
|
kitchen_provisioner_api_version 2
|
@@ -31,6 +30,9 @@ module Kitchen
|
|
31
30
|
default_config :configuration_data_variable, 'ConfigurationData'
|
32
31
|
default_config :configuration_data
|
33
32
|
|
33
|
+
default_config :nuget_force_bootstrap, true
|
34
|
+
default_config :gallery_uri
|
35
|
+
default_config :gallery_name
|
34
36
|
default_config :modules_from_gallery
|
35
37
|
|
36
38
|
default_config :dsc_local_configuration_manager_version, 'wmf4'
|
@@ -61,13 +63,10 @@ module Kitchen
|
|
61
63
|
configuration_mode: (resolve_lcm_setting 'configuration_mode', 'ApplyAndAutoCorrect'),
|
62
64
|
debug_mode: (resolve_lcm_setting 'debug_mode', 'All'),
|
63
65
|
reboot_if_needed: (resolve_lcm_setting 'reboot_if_needed', false),
|
64
|
-
refresh_mode: (resolve_lcm_setting 'refresh_mode'
|
66
|
+
refresh_mode: (resolve_lcm_setting 'refresh_mode', 'PUSH')
|
65
67
|
}
|
66
68
|
end
|
67
69
|
|
68
|
-
|
69
|
-
# Disable line length check, it is all embedded script.
|
70
|
-
# rubocop:disable Metrics/LineLength
|
71
70
|
def install_command
|
72
71
|
lcm_config = lcm_settings
|
73
72
|
case config[:dsc_local_configuration_manager_version]
|
@@ -142,14 +141,34 @@ module Kitchen
|
|
142
141
|
|
143
142
|
def powershell_modules
|
144
143
|
Array(config[:modules_from_gallery]).map do |powershell_module|
|
145
|
-
"
|
144
|
+
info("Installing #{powershell_module} from #{psmodule_repository_name}.")
|
145
|
+
"install-module '#{powershell_module}' -Repository #{psmodule_repository_name} -force | out-null"
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
+
def nuget_force_bootstrap
|
150
|
+
return unless config[:nuget_force_bootstrap]
|
151
|
+
info('Bootstrapping the nuget package provider for PowerShell PackageManagement.')
|
152
|
+
'install-packageprovider nuget -force -forcebootstrap | out-null'
|
153
|
+
end
|
154
|
+
|
155
|
+
def psmodule_repository_name
|
156
|
+
return 'PSGallery' if config[:gallery_name].nil? && config[:gallery_uri].nil?
|
157
|
+
return 'testing' if config[:gallery_name].nil?
|
158
|
+
config[:gallery_name]
|
159
|
+
end
|
160
|
+
|
161
|
+
def register_psmodule_repository
|
162
|
+
return if config[:gallery_uri].nil?
|
163
|
+
info("Registering a new PowerShellGet Repository - #{psmodule_repository_name}")
|
164
|
+
"register-packagesource -providername PowerShellGet -name '#{psmodule_repository_name}' -location '#{config[:gallery_uri]}' -force -trusted"
|
165
|
+
end
|
166
|
+
|
149
167
|
def install_module_script
|
150
168
|
return if config[:modules_from_gallery].nil?
|
151
|
-
|
152
|
-
|
169
|
+
<<-EOH
|
170
|
+
#{nuget_force_bootstrap}
|
171
|
+
#{register_psmodule_repository}
|
153
172
|
#{powershell_modules.join("\n")}
|
154
173
|
EOH
|
155
174
|
end
|
@@ -179,8 +198,6 @@ module Kitchen
|
|
179
198
|
prepare_configuration_script
|
180
199
|
end
|
181
200
|
|
182
|
-
# Disable line length check, it is all logging and embedded script.
|
183
|
-
# rubocop:disable Metrics/LineLength
|
184
201
|
def prepare_command
|
185
202
|
info('Moving DSC Resources onto PSModulePath')
|
186
203
|
info("Generating the MOF script for the configuration #{config[:configuration_name]}")
|
@@ -259,7 +276,7 @@ module Kitchen
|
|
259
276
|
def list_files(path)
|
260
277
|
base_directory_content = Dir.glob(File.join(path, '*'))
|
261
278
|
nested_directory_content = Dir.glob(File.join(path, '*/**/*'))
|
262
|
-
all_directory_content =
|
279
|
+
all_directory_content = [base_directory_content, nested_directory_content].flatten
|
263
280
|
|
264
281
|
ignore_files = ['Gemfile', 'Gemfile.lock', 'README.md', 'LICENSE.txt']
|
265
282
|
all_directory_content.reject do |f|
|
@@ -290,10 +307,10 @@ module Kitchen
|
|
290
307
|
sandbox_module_path = File.join(sandbox_path, 'modules')
|
291
308
|
|
292
309
|
if Dir.exist?(module_path)
|
293
|
-
|
294
|
-
|
310
|
+
debug("Moving #{module_path} to #{sandbox_module_path}")
|
311
|
+
FileUtils.cp_r(module_path, sandbox_module_path)
|
295
312
|
else
|
296
|
-
|
313
|
+
debug("The modules path #{module_path} was not found. Not moving to #{sandbox_module_path}.")
|
297
314
|
end
|
298
315
|
end
|
299
316
|
|
@@ -302,19 +319,19 @@ module Kitchen
|
|
302
319
|
end
|
303
320
|
|
304
321
|
def pad(depth = 0)
|
305
|
-
|
322
|
+
' ' * depth
|
306
323
|
end
|
307
324
|
|
308
325
|
def ps_hash(obj, depth = 0)
|
309
326
|
if obj.is_a?(Hash)
|
310
|
-
obj.map
|
311
|
-
%
|
312
|
-
|
327
|
+
obj.map do |k, v|
|
328
|
+
%(#{pad(depth + 2)}#{ps_hash(k)} = #{ps_hash(v, depth + 2)})
|
329
|
+
end.join(";\n").insert(0, "@{\n").insert(-1, "\n#{pad(depth)}}")
|
313
330
|
elsif obj.is_a?(Array)
|
314
|
-
array_string = obj.map { |v| ps_hash(v, depth+4)}.join(
|
331
|
+
array_string = obj.map { |v| ps_hash(v, depth + 4) }.join(',')
|
315
332
|
"#{pad(depth)}@(\n#{array_string}\n)"
|
316
333
|
else
|
317
|
-
%
|
334
|
+
%("#{obj}")
|
318
335
|
end
|
319
336
|
end
|
320
337
|
|
data/lib/kitchen-dsc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-dsc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Murawski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -118,7 +118,7 @@ description: |+
|
|
118
118
|
TBD
|
119
119
|
|
120
120
|
email:
|
121
|
-
-
|
121
|
+
- smurawski@chef.io
|
122
122
|
executables: []
|
123
123
|
extensions: []
|
124
124
|
extra_rdoc_files: []
|