kitchen-dsc 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 +4 -4
- data/kitchen-dsc.gemspec +1 -1
- data/lib/kitchen-dsc/version.rb +1 -1
- data/lib/kitchen/provisioner/dsc.rb +25 -2
- 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: 738167d2b4abdbc0b05048c64a965c801f3d2e10
|
4
|
+
data.tar.gz: f56a0e14b764ad65f7e2f38b45493c81f7687077
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f60f1434718fc5c72f18e474c5ba1a0f99686c13619b284fb7564ba19c7f41ac35dfddd6c417a9dd3441d4e5771a5107f61e90629b9155e5c9a4150f7b7ab89
|
7
|
+
data.tar.gz: 501b9d24510aeadd805851323ba917035566bcd457bca7fb0c6f66bebda0a063f637164440dd6143be1409e5b86eb652a624691c16e4f38a6f48687d47713368
|
data/kitchen-dsc.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = Kitchen::Dsc::VERSION
|
9
9
|
s.authors = ['Steven Murawski']
|
10
10
|
s.email = ['steven.murawski@gmail.com']
|
11
|
-
s.homepage = 'https://github.com/
|
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']
|
14
14
|
s.files = candidates.sort
|
data/lib/kitchen-dsc/version.rb
CHANGED
@@ -27,7 +27,9 @@ module Kitchen
|
|
27
27
|
default_config :configuration_name do |provisioner|
|
28
28
|
provisioner.instance.suite.name
|
29
29
|
end
|
30
|
+
|
30
31
|
default_config :configuration_data_variable
|
32
|
+
default_config :configuration_data
|
31
33
|
|
32
34
|
default_config :dsc_local_configuration_manager_version, 'wmf4'
|
33
35
|
default_config :dsc_local_configuration_manager, {
|
@@ -90,6 +92,7 @@ module Kitchen
|
|
90
92
|
CertificateID = '#{lcm_config[:certificate_id].nil? ? '$null' : lcm_config[:certificate_id]}'
|
91
93
|
ConfigurationMode = '#{lcm_config[:configuration_mode]}'
|
92
94
|
ConfigurationModeFrequencyMins = #{lcm_config[:configuration_mode_frequency_mins].nil? ? '15' : lcm_config[:configuration_mode_frequency_mins]}
|
95
|
+
DebugMode = '#{lcm_config[:debug_mode]}'
|
93
96
|
RebootNodeIfNeeded = [bool]::Parse('#{lcm_config[:reboot_if_needed]}')
|
94
97
|
RefreshFrequencyMins = #{lcm_config[:refresh_frequency_mins].nil? ? '30' : lcm[:refresh_frequency_mins]}
|
95
98
|
RefreshMode = '#{lcm_config[:refresh_mode]}'
|
@@ -102,7 +105,6 @@ module Kitchen
|
|
102
105
|
|
103
106
|
$null = SetupLCM
|
104
107
|
Set-DscLocalConfigurationManager -Path ./SetupLCM
|
105
|
-
if ($PSVersionTable.PSVersion.Major -ge 5) {Enable-DscDebug}
|
106
108
|
EOH
|
107
109
|
|
108
110
|
wrap_shell_code(full_lcm_configuration_script)
|
@@ -127,6 +129,7 @@ module Kitchen
|
|
127
129
|
# Disable line length check, it is all logging and embedded script.
|
128
130
|
# rubocop:disable Metrics/LineLength
|
129
131
|
def prepare_command
|
132
|
+
configuration_data_variable = config[:configuration_data_variable].nil? ? 'ConfigurationData' : config[:configuration_data_variable]
|
130
133
|
info('Moving DSC Resources onto PSModulePath')
|
131
134
|
info("Generating the MOF script for the configuration #{config[:configuration_name]}")
|
132
135
|
stage_resources_and_generate_mof_script = <<-EOH
|
@@ -149,7 +152,10 @@ module Kitchen
|
|
149
152
|
{
|
150
153
|
throw "Failed to create a configuration command #{config[:configuration_name]}"
|
151
154
|
}
|
152
|
-
|
155
|
+
|
156
|
+
#{'$ConfigurationData = ' + ps_hash(config[:configuration_data]) unless config[:configuration_data].nil?}
|
157
|
+
|
158
|
+
$null = #{config[:configuration_name]} -outputpath c:/configurations #{'-configurationdata $' + configuration_data_variable}
|
153
159
|
EOH
|
154
160
|
debug("Shelling out: #{stage_resources_and_generate_mof_script}")
|
155
161
|
wrap_shell_code(stage_resources_and_generate_mof_script)
|
@@ -229,6 +235,23 @@ module Kitchen
|
|
229
235
|
File.join('configuration', config[:configuration_script])
|
230
236
|
end
|
231
237
|
|
238
|
+
def pad(depth = 0)
|
239
|
+
" " * depth
|
240
|
+
end
|
241
|
+
|
242
|
+
def ps_hash(obj, depth = 0)
|
243
|
+
if obj.is_a?(Hash)
|
244
|
+
obj.map { |k, v|
|
245
|
+
%{#{pad(depth + 2)}#{ps_hash(k)} = #{ps_hash(v, depth + 2)}}
|
246
|
+
}.join(";\n").insert(0, "@{\n").insert(-1, "\n#{pad(depth)}}")
|
247
|
+
elsif obj.is_a?(Array)
|
248
|
+
array_string = obj.map { |v| ps_hash(v, depth+4)}.join(",")
|
249
|
+
"#{pad(depth)}@(\n#{array_string}\n)"
|
250
|
+
else
|
251
|
+
%{"#{obj}"}
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
232
255
|
def prepare_configuration_script
|
233
256
|
configuration_script_file = File.join(config[:configuration_script_folder], config[:configuration_script])
|
234
257
|
configuration_script_path = File.join(config[:kitchen_root], configuration_script_file)
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Murawski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -127,7 +127,7 @@ files:
|
|
127
127
|
- kitchen-dsc.gemspec
|
128
128
|
- lib/kitchen-dsc/version.rb
|
129
129
|
- lib/kitchen/provisioner/dsc.rb
|
130
|
-
homepage: https://github.com/
|
130
|
+
homepage: https://github.com/test-kitchen/kitchen-dsc
|
131
131
|
licenses:
|
132
132
|
- Apache 2
|
133
133
|
metadata: {}
|