kitchen-dsc 0.11.0 → 0.11.1

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
- SHA1:
3
- metadata.gz: e624fe030f3b2b0b22bc97d9225668a67c55045e
4
- data.tar.gz: f9c7ce4985d3115dc6ee61f10dd57d76f96b17b4
2
+ SHA256:
3
+ metadata.gz: 4ade7390054a821859906f83d82fa6aa9db0870107d9cc57a089fb21af5daf53
4
+ data.tar.gz: 229a88ab64db1172e971767a680b5c06b495f7bb91b9f2e9c4caaa7e360ea4e0
5
5
  SHA512:
6
- metadata.gz: 6c6bdec9163a77a027f07101c4806305528b8b3aa6b7d2694c7ea000d56ba3b25d62a8c922f3f410adc3c81383056ceafccf14d0b8683c7cceb14709b0e7823e
7
- data.tar.gz: '0686ca5ffd4a6b58115220aab4d157ef11a34a588e2b76d50326d880012a2d5f073a6a7d3db7e6ccec16aa7f49a356d1d37567ae159f648b43847b614cd3058f'
6
+ metadata.gz: 3cfbe09cfe4174b14d57db58236e8f172366d74c693866c1df6e55bd89c15a5c3869a025c300fe7651d9d2fdca00deb8ff99c3dfba9cff6d9dc17a5c2d95d0af
7
+ data.tar.gz: 2b51a1fdefd9b1bc951d95949ac37110b0a4f953209f83522f323527e982fc789797f0be1459dfd2f1b3d8dab933bafafb4c30e97be2240acf0c3b9bbbce802c
data/README.md CHANGED
@@ -1,108 +1,111 @@
1
- [![Gem Version](https://badge.fury.io/rb/kitchen-dsc.svg)](http://badge.fury.io/rb/kitchen-dsc)
2
-
3
- # kitchen-dsc
4
- A Test Kitchen Provisioner for PowerShell DSC
5
-
6
-
7
- ## Requirements
8
- You'll need a driver box with WMF4 or greater (ONLY WINDOWS SYSTEMS)
9
-
10
- ## Installation & Setup
11
- You'll need the test-kitchen & kitchen-dsc gems installed in your system, along with kitchen-vagrant or some ther suitable driver for test-kitchen.
12
-
13
- ### Note:
14
- You will see a delay in the return of the run details due to an difference in how the verbose stream is returned for DSC runs between WMF versions, so I return the verbose stream after the job completes. I'd love to live stream the results, but that'll take a bit more experimentation. (PR's welcome!)
15
-
16
- ## Example Configurations
17
- * [Repository Style Testing](https://github.com/smurawski/dsc-kitchen-project)
18
- * [Module Style Testing](https://github.com/powershellorg/cwebadministration/tree/smurawski/adding_tests)
19
-
20
- ## Configuration Settings
21
- * configuration_script_folder
22
- * Defaults to 'examples'.
23
- * The location of a PowerShell script(s) containing the DSC configuration command(s).
24
-
25
- * configuration_script
26
- * Defaults to 'dsc_configuration.ps1'
27
- * The name of the PowerShell script containing the DSC configuration command(s) (and possibly configuration data)
28
-
29
- * configuration_name
30
- * Name of the configuration to run, defaults to the suite name.
31
-
32
- * configuration_data
33
- * A YAML representation of what should be passed to the configuration.
34
- * Overrides any configurationdata variable assigned in the configuration script.
35
-
36
- * configuration_data_variable
37
- * Defaults to 'ConfigurationData'
38
- * Name of the variable that contains the ConfigurationData hashtable
39
- * Can be defined in the configuration script or via the `configuration_data` configuration setting.
40
-
41
- * dsc_local_configuration_manager_version
42
- * Defaults to 'wmf4'
43
- * Identifies what version of the LCM is in place
44
- * Other valid values are 'wmf4_with_update' and 'wmf5'
45
- * Currently the only difference between wmf4 and wmf4_with_update/wmf5 is the action_after_reboot and the debug_mode settings. Eventually, I'd like to add support for partial configurations, pull servers, etc..
46
- * In this context, wmf4_with_update refers to wmf4 with KB3000850 applied (to add support for WMF 5 generated configurations, plus some fixes).
47
-
48
- * dsc_local_configuration_manager
49
- * Settings for the LCM
50
- * Defaults are:
51
- * action_after_reboot = 'StopConfiguration' # wmf4_with_update or wmf5
52
- * reboot_if_needed = false
53
- * allow_module_overwrite = false
54
- * certificate_id = nil
55
- * configuration_mode = 'ApplyAndAutoCorrect'
56
- * configuration_mode_frequency_mins = 30 # 15 on wmf5
57
- * debug_mode = 'All' # wmf4_with_update
58
- * refresh_frequency_mins = 15 # 30 on wmf5
59
- * refresh_mode = 'PUSH'
60
-
61
- * modules_from_gallery
62
- * Requires WMF 5
63
- * Takes a string (for one module) or an array (for multiple) to install from the gallery
64
- * Or takes a hash with keys matching the parameters for install-module.
65
- * Name is required.
66
- * Force is automatically used and not required as part of the hash table.
67
- * Repository defaults to either PSGallery or any custom feed defined, but can be overriden here.
68
-
69
- * gallery_name
70
- * Custom PowerShell gallery name to install modules from.
71
- * If there is no package source with this name registered on the machine, then gallery_uri must be configured as well.
72
-
73
- * gallery_uri
74
- * URI for a custom PowerShell gallery feed.
75
-
76
- ### Specific to repository style testing
77
- * modules_path
78
- * Defaults to 'modules'.
79
- * Points to the location of modules containing DSC resources to upload
80
- * This path is relative to the root of the repository (the location of the .kitchen.yml).
81
-
82
- ## Example
83
-
84
- ```yaml
85
- provisioner:
86
- - name: dsc
87
- dsc_local_configuration_manager_version: wmf5
88
- dsc_local_configuration_manager:
89
- reboot_if_needed: true
90
- debug_mode: none
91
- configuration_script_folder: .
92
- configuration_script: SampleConfig.ps1
93
- gallery_uri: https://ci.appveyor.com/nuget/xWebAdministration
94
- gallery_name: xWebDevFeed
95
- modules_from_gallery:
96
- - xWebAdministration
97
- - name: xComputerManagement
98
- requiredversion: 1.4.0.0
99
- repository: PSGallery
100
-
101
- suite:
102
- - name: test
103
- provisioner:
104
- configuration_data:
105
- AllNodes:
106
- - nodename: localhost
107
- role: webserver
108
- ```
1
+ [![Gem Version](https://badge.fury.io/rb/kitchen-dsc.svg)](http://badge.fury.io/rb/kitchen-dsc)
2
+
3
+ # kitchen-dsc
4
+ A Test Kitchen Provisioner for PowerShell DSC
5
+
6
+ ## Status
7
+
8
+ This software project is no longer under active development as it has no active maintainers. The software may continue to work for some or all use cases, but issues filed in GitHub will most likely not be triaged. If a new maintainer is interested in working on this project please come chat with us in #test-kitchen on Chef Community Slack.
9
+
10
+ ## Requirements
11
+ You'll need a driver box with WMF4 or greater (ONLY WINDOWS SYSTEMS)
12
+
13
+ ## Installation & Setup
14
+ You'll need the test-kitchen & kitchen-dsc gems installed in your system, along with kitchen-vagrant or some ther suitable driver for test-kitchen.
15
+
16
+ ### Note:
17
+ You will see a delay in the return of the run details due to an difference in how the verbose stream is returned for DSC runs between WMF versions, so I return the verbose stream after the job completes. I'd love to live stream the results, but that'll take a bit more experimentation. (PR's welcome!)
18
+
19
+ ## Example Configurations
20
+ * [Repository Style Testing](https://github.com/smurawski/dsc-kitchen-project)
21
+ * [Module Style Testing](https://github.com/powershellorg/cwebadministration/tree/smurawski/adding_tests)
22
+
23
+ ## Configuration Settings
24
+ * configuration_script_folder
25
+ * Defaults to 'examples'.
26
+ * The location of a PowerShell script(s) containing the DSC configuration command(s).
27
+
28
+ * configuration_script
29
+ * Defaults to 'dsc_configuration.ps1'
30
+ * The name of the PowerShell script containing the DSC configuration command(s) (and possibly configuration data)
31
+
32
+ * configuration_name
33
+ * Name of the configuration to run, defaults to the suite name.
34
+
35
+ * configuration_data
36
+ * A YAML representation of what should be passed to the configuration.
37
+ * Overrides any configurationdata variable assigned in the configuration script.
38
+
39
+ * configuration_data_variable
40
+ * Defaults to 'ConfigurationData'
41
+ * Name of the variable that contains the ConfigurationData hashtable
42
+ * Can be defined in the configuration script or via the `configuration_data` configuration setting.
43
+
44
+ * dsc_local_configuration_manager_version
45
+ * Defaults to 'wmf4'
46
+ * Identifies what version of the LCM is in place
47
+ * Other valid values are 'wmf4_with_update' and 'wmf5'
48
+ * Currently the only difference between wmf4 and wmf4_with_update/wmf5 is the action_after_reboot and the debug_mode settings. Eventually, I'd like to add support for partial configurations, pull servers, etc..
49
+ * In this context, wmf4_with_update refers to wmf4 with KB3000850 applied (to add support for WMF 5 generated configurations, plus some fixes).
50
+
51
+ * dsc_local_configuration_manager
52
+ * Settings for the LCM
53
+ * Defaults are:
54
+ * action_after_reboot = 'StopConfiguration' # wmf4_with_update or wmf5
55
+ * reboot_if_needed = false
56
+ * allow_module_overwrite = false
57
+ * certificate_id = nil
58
+ * configuration_mode = 'ApplyAndAutoCorrect'
59
+ * configuration_mode_frequency_mins = 30 # 15 on wmf5
60
+ * debug_mode = 'All' # wmf4_with_update
61
+ * refresh_frequency_mins = 15 # 30 on wmf5
62
+ * refresh_mode = 'PUSH'
63
+
64
+ * modules_from_gallery
65
+ * Requires WMF 5
66
+ * Takes a string (for one module) or an array (for multiple) to install from the gallery
67
+ * Or takes a hash with keys matching the parameters for install-module.
68
+ * Name is required.
69
+ * Force is automatically used and not required as part of the hash table.
70
+ * Repository defaults to either PSGallery or any custom feed defined, but can be overriden here.
71
+
72
+ * gallery_name
73
+ * Custom PowerShell gallery name to install modules from.
74
+ * If there is no package source with this name registered on the machine, then gallery_uri must be configured as well.
75
+
76
+ * gallery_uri
77
+ * URI for a custom PowerShell gallery feed.
78
+
79
+ ### Specific to repository style testing
80
+ * modules_path
81
+ * Defaults to 'modules'.
82
+ * Points to the location of modules containing DSC resources to upload
83
+ * This path is relative to the root of the repository (the location of the .kitchen.yml).
84
+
85
+ ## Example
86
+
87
+ ```yaml
88
+ provisioner:
89
+ - name: dsc
90
+ dsc_local_configuration_manager_version: wmf5
91
+ dsc_local_configuration_manager:
92
+ reboot_if_needed: true
93
+ debug_mode: none
94
+ configuration_script_folder: .
95
+ configuration_script: SampleConfig.ps1
96
+ gallery_uri: https://ci.appveyor.com/nuget/xWebAdministration
97
+ gallery_name: xWebDevFeed
98
+ modules_from_gallery:
99
+ - xWebAdministration
100
+ - name: xComputerManagement
101
+ requiredversion: 1.4.0.0
102
+ repository: PSGallery
103
+
104
+ suite:
105
+ - name: test
106
+ provisioner:
107
+ configuration_data:
108
+ AllNodes:
109
+ - nodename: localhost
110
+ role: webserver
111
+ ```
@@ -1,48 +1,46 @@
1
- # encoding: utf-8
2
-
3
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
4
- require "kitchen-dsc/version"
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "kitchen-dsc"
8
- s.version = Kitchen::Dsc::VERSION
9
- s.authors = ["Steven Murawski"]
10
- s.email = ["smurawski@chef.io"]
11
- s.homepage = "https://github.com/test-kitchen/kitchen-dsc"
12
- s.summary = "PowerShell DSC provisioner for test-kitchen"
13
- candidates = Dir.glob("lib/**/*") + ["README.md", "kitchen-dsc.gemspec"]
14
- s.files = candidates.sort
15
- s.platform = Gem::Platform::RUBY
16
- s.require_paths = ["lib"]
17
- s.rubyforge_project = "[none]"
18
- s.license = "Apache 2"
19
- s.description = <<-EOF
20
- == DESCRIPTION:
21
-
22
- DSC Provisioner for Test Kitchen
23
-
24
- == FEATURES:
25
-
26
- TBD
27
-
28
- EOF
29
- s.add_dependency "test-kitchen", ">= 1.9"
30
- s.add_dependency "dsc_lcm_configuration"
31
-
32
- s.add_development_dependency "countloc", "~> 0.4"
33
- s.add_development_dependency "rake"
34
- s.add_development_dependency "rspec", "~> 3.2"
35
- s.add_development_dependency "simplecov", "~> 0.9"
36
- s.add_development_dependency "minitest", "~> 5.3"
37
- s.add_development_dependency "yard", "~> 0.8"
38
- s.add_development_dependency "pry"
39
- s.add_development_dependency "pry-stack_explorer"
40
- s.add_development_dependency "pry-byebug"
41
- s.add_development_dependency "rb-readline"
42
-
43
- # style and complexity libraries are tightly version pinned as newer releases
44
- # may introduce new and undesireable style choices which would be immediately
45
- # enforced in CI
46
- s.add_development_dependency "finstyle", "1.4.0"
47
- s.add_development_dependency "cane", "2.6.2"
48
- end
1
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
+ require "kitchen-dsc/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "kitchen-dsc"
6
+ s.version = Kitchen::Dsc::VERSION
7
+ s.authors = ["Steven Murawski"]
8
+ s.email = ["smurawski@chef.io"]
9
+ s.homepage = "https://github.com/test-kitchen/kitchen-dsc"
10
+ s.summary = "PowerShell DSC provisioner for test-kitchen"
11
+ candidates = Dir.glob("lib/**/*") + ["README.md", "kitchen-dsc.gemspec"]
12
+ s.files = candidates.sort
13
+ s.platform = Gem::Platform::RUBY
14
+ s.require_paths = ["lib"]
15
+ s.rubyforge_project = "[none]"
16
+ s.license = "Apache-2.0"
17
+ s.description = <<~EOF
18
+ == DESCRIPTION:
19
+
20
+ DSC Provisioner for Test Kitchen
21
+
22
+ == FEATURES:
23
+
24
+ TBD
25
+
26
+ EOF
27
+ s.add_dependency "test-kitchen", ">= 1.9"
28
+ s.add_dependency "dsc_lcm_configuration"
29
+
30
+ s.add_development_dependency "countloc", "~> 0.4"
31
+ s.add_development_dependency "rake"
32
+ s.add_development_dependency "rspec", "~> 3.2"
33
+ s.add_development_dependency "simplecov", "~> 0.9"
34
+ s.add_development_dependency "minitest", "~> 5.3"
35
+ s.add_development_dependency "yard", "~> 0.8"
36
+ s.add_development_dependency "pry"
37
+ s.add_development_dependency "pry-stack_explorer"
38
+ s.add_development_dependency "pry-byebug"
39
+ s.add_development_dependency "rb-readline"
40
+
41
+ # style and complexity libraries are tightly version pinned as newer releases
42
+ # may introduce new and undesireable style choices which would be immediately
43
+ # enforced in CI
44
+ s.add_development_dependency "chefstyle", "1.2.1"
45
+ s.add_development_dependency "cane", "3.0.0"
46
+ end
@@ -1,7 +1,5 @@
1
- # encoding: utf-8
2
-
3
1
  module Kitchen
4
2
  module Dsc
5
- VERSION = '0.11.0'.freeze
3
+ VERSION = "0.11.1".freeze
6
4
  end
7
5
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  #
3
2
  # Author:: Steven Murawski (<steven.murawski@gmail.com>)
4
3
  #
@@ -7,8 +6,8 @@
7
6
  # Licensed under the Apache 2 License.
8
7
  # See LICENSE for more details
9
8
 
10
- require "fileutils"
11
- require "pathname"
9
+ require "fileutils" unless defined?(FileUtils)
10
+ require "pathname" unless defined?(Pathname)
12
11
  require "kitchen/provisioner/base"
13
12
  require "kitchen/util"
14
13
  require "dsc_lcm_configuration"
@@ -55,9 +54,9 @@ module Kitchen
55
54
  end
56
55
 
57
56
  def init_command
58
- script = <<-EOH
59
- #{setup_config_directory_script}
60
- #{install_module_script if install_modules?}
57
+ script = <<~EOH
58
+ #{setup_config_directory_script}
59
+ #{install_module_script if install_modules?}
61
60
  EOH
62
61
  wrap_powershell_code(script)
63
62
  end
@@ -77,7 +76,7 @@ module Kitchen
77
76
  def prepare_command
78
77
  info("Moving DSC Resources onto PSModulePath")
79
78
  scripts = <<-EOH
80
-
79
+
81
80
  if (Test-Path (join-path #{config[:root_path]} 'modules'))
82
81
  {
83
82
  dir ( join-path #{config[:root_path]} 'modules/*') -directory |
@@ -95,38 +94,38 @@ module Kitchen
95
94
  ensure_array(config[:configuration_name]).each do |configuration|
96
95
  info("Generating the MOF script for the configuration #{configuration}")
97
96
  stage_resources_and_generate_mof_script = <<-EOH
98
-
97
+
99
98
  if(Test-Path c:/configurations/#{configuration})
100
99
  {
101
100
  Remove-Item -Recurse -Force c:/configurations/#{configuration}
102
101
  }
103
-
102
+
104
103
  $Error.clear()
105
-
104
+
106
105
  if (-not (test-path 'c:/configurations'))
107
106
  {
108
107
  mkdir 'c:/configurations' | out-null
109
108
  }
110
-
109
+
111
110
  if (-not (get-command #{configuration}))
112
111
  {
113
112
  throw "Failed to create a configuration command #{configuration}"
114
113
  }
115
-
114
+
116
115
  #{configuration_data_assignment unless config[:configuration_data].nil?}
117
-
116
+
118
117
  try{
119
118
  $null = #{configuration} -outputpath c:/configurations/#{configuration} #{"-configurationdata $" + configuration_data_variable}
120
119
  }
121
120
  catch{
122
121
  }
123
-
122
+
124
123
  if($Error -ne $null)
125
124
  {
126
125
  $Error[-1]
127
126
  exit 1
128
127
  }
129
-
128
+
130
129
  EOH
131
130
  scripts << stage_resources_and_generate_mof_script
132
131
  end
@@ -137,7 +136,7 @@ module Kitchen
137
136
  def run_command
138
137
  config[:retry_on_exit_code] = [35] if config[:retry_on_exit_code].empty?
139
138
  config[:max_retries] = 3 if config[:max_retries] == 1
140
- scripts = ''
139
+ scripts = ""
141
140
  ensure_array(config[:configuration_name]).each do |configuration|
142
141
  info("Running the configuration #{configuration}")
143
142
  run_configuration_script = <<-EOH
@@ -177,12 +176,12 @@ module Kitchen
177
176
  end
178
177
 
179
178
  def powershell_module_params(module_specification_hash)
180
- keys = module_specification_hash.keys.reject { |k| k.to_s.casecmp('force') == 0 }
181
- unless keys.any? { |k| k.to_s.downcase == 'repository' }
179
+ keys = module_specification_hash.keys.reject { |k| k.to_s.casecmp("force") == 0 }
180
+ unless keys.any? { |k| k.to_s.downcase == "repository" }
182
181
  keys.push(:repository)
183
182
  module_specification_hash[:repository] = psmodule_repository_name
184
183
  end
185
- keys.map { |key| "-#{key} #{module_specification_hash[key]}" }.join(' ')
184
+ keys.map { |key| "-#{key} #{module_specification_hash[key]}" }.join(" ")
186
185
  end
187
186
 
188
187
  def powershell_modules
@@ -198,6 +197,7 @@ module Kitchen
198
197
 
199
198
  def nuget_force_bootstrap
200
199
  return unless config[:nuget_force_bootstrap]
200
+
201
201
  info("Bootstrapping the nuget package provider for PowerShell PackageManagement.")
202
202
  "install-packageprovider nuget -force -forcebootstrap | out-null"
203
203
  end
@@ -205,17 +205,20 @@ module Kitchen
205
205
  def psmodule_repository_name
206
206
  return "PSGallery" if config[:gallery_name].nil? && config[:gallery_uri].nil?
207
207
  return "testing" if config[:gallery_name].nil?
208
+
208
209
  config[:gallery_name]
209
210
  end
210
211
 
211
212
  def register_psmodule_repository
212
213
  return if config[:gallery_uri].nil?
214
+
213
215
  info("Registering a new PowerShellGet Repository - #{psmodule_repository_name}")
214
216
  "register-packagesource -providername PowerShellGet -name '#{psmodule_repository_name}' -location '#{config[:gallery_uri]}' -force -trusted"
215
217
  end
216
218
 
217
219
  def install_module_script
218
220
  return if config[:modules_from_gallery].nil?
221
+
219
222
  <<-EOH
220
223
  #{nuget_force_bootstrap}
221
224
  #{register_psmodule_repository}
@@ -270,7 +273,7 @@ module Kitchen
270
273
  FileUtils.mkdir_p(File.dirname(dest))
271
274
  debug("Staging #{src} ")
272
275
  debug(" at #{dest}")
273
- FileUtils.cp(src, dest, :preserve => true)
276
+ FileUtils.cp(src, dest, preserve: true)
274
277
  end
275
278
  end
276
279
 
@@ -318,9 +321,9 @@ module Kitchen
318
321
 
319
322
  def ensure_array(thing)
320
323
  if thing.is_a?(Array)
321
- return thing
324
+ thing
322
325
  else
323
- return [thing]
326
+ [thing]
324
327
  end
325
328
  end
326
329
  end
@@ -1,88 +1,86 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Steven Murawski (<steven.murawski@gmail.com>)
4
- #
5
- # Copyright (C) 2014 Steven Murawski
6
- #
7
- # Licensed under the Apache 2 License.
8
- # See LICENSE for more details
9
-
10
- require "kitchen/provisioner/dsc_lcm/lcm_v4"
11
- require "kitchen/provisioner/dsc_lcm/lcm_v5"
12
-
13
- module Kitchen
14
- module Provisioner
15
- module DscLcm
16
- class LcmBase
17
-
18
-
19
-
20
- def lcm_properties
21
- {
22
- :allow_module_overwrite => false,
23
- :certificate_id => nil,
24
- :configuration_mode => "ApplyAndAutoCorrect",
25
- :configuration_mode_frequency_mins => 30,
26
- :reboot_if_needed => false,
27
- :refresh_mode => "PUSH",
28
- :refresh_frequency_mins => 15
29
- }
30
- end
31
-
32
- def initialize(config = {})
33
- @certificate_id = nil
34
- lcm_properties.each do |setting, value|
35
- send(setting, value)
36
- end
37
-
38
- config.each do |setting, value|
39
- send(setting, value)
40
- end
41
- end
42
-
43
- def method_missing(name, *args)
44
- return super unless lcm_properties.keys.include?(name)
45
- if args.length == 1
46
- instance_variable_set("@#{name}", args.first)
47
- else
48
- instance_variable_get("@#{name}")
49
- end
50
- end
51
-
52
- def certificate_id(value = nil)
53
- if value.nil?
54
- @certificate_id.nil? ? "$null" : "'#{@certificate_id}'"
55
- else
56
- @certificate_id = value
57
- end
58
- end
59
-
60
- def lcm_config
61
- hash = {}
62
- lcm_properties.keys.each do |key|
63
- hash[key] = send(key)
64
- end
65
- hash
66
- end
67
-
68
- def lcm_configuration_script
69
- <<-LCMSETUP
70
- configuration SetupLCM
71
- {
72
- LocalConfigurationManager
73
- {
74
- AllowModuleOverwrite = [bool]::Parse('#{allow_module_overwrite}')
75
- CertificateID = #{certificate_id}
76
- ConfigurationMode = '#{configuration_mode}'
77
- ConfigurationModeFrequencyMins = #{configuration_mode_frequency_mins}
78
- RebootNodeIfNeeded = [bool]::Parse('#{reboot_if_needed}')
79
- RefreshFrequencyMins = #{refresh_frequency_mins}
80
- RefreshMode = '#{refresh_mode}'
81
- }
82
- }
83
- LCMSETUP
84
- end
85
- end
86
- end
87
- end
88
- end
1
+ #
2
+ # Author:: Steven Murawski (<steven.murawski@gmail.com>)
3
+ #
4
+ # Copyright (C) 2014 Steven Murawski
5
+ #
6
+ # Licensed under the Apache 2 License.
7
+ # See LICENSE for more details
8
+
9
+ require_relative "lcm_v4"
10
+ require_relative "lcm_v5"
11
+
12
+ module Kitchen
13
+ module Provisioner
14
+ module DscLcm
15
+ class LcmBase
16
+
17
+ def lcm_properties
18
+ {
19
+ allow_module_overwrite: false,
20
+ certificate_id: nil,
21
+ configuration_mode: "ApplyAndAutoCorrect",
22
+ configuration_mode_frequency_mins: 30,
23
+ reboot_if_needed: false,
24
+ refresh_mode: "PUSH",
25
+ refresh_frequency_mins: 15,
26
+ }
27
+ end
28
+
29
+ def initialize(config = {})
30
+ @certificate_id = nil
31
+ lcm_properties.each do |setting, value|
32
+ send(setting, value)
33
+ end
34
+
35
+ config.each do |setting, value|
36
+ send(setting, value)
37
+ end
38
+ end
39
+
40
+ def method_missing(name, *args)
41
+ return super unless lcm_properties.keys.include?(name)
42
+
43
+ if args.length == 1
44
+ instance_variable_set("@#{name}", args.first)
45
+ else
46
+ instance_variable_get("@#{name}")
47
+ end
48
+ end
49
+
50
+ def certificate_id(value = nil)
51
+ if value.nil?
52
+ @certificate_id.nil? ? "$null" : "'#{@certificate_id}'"
53
+ else
54
+ @certificate_id = value
55
+ end
56
+ end
57
+
58
+ def lcm_config
59
+ hash = {}
60
+ lcm_properties.keys.each do |key|
61
+ hash[key] = send(key)
62
+ end
63
+ hash
64
+ end
65
+
66
+ def lcm_configuration_script
67
+ <<-LCMSETUP
68
+ configuration SetupLCM
69
+ {
70
+ LocalConfigurationManager
71
+ {
72
+ AllowModuleOverwrite = [bool]::Parse('#{allow_module_overwrite}')
73
+ CertificateID = #{certificate_id}
74
+ ConfigurationMode = '#{configuration_mode}'
75
+ ConfigurationModeFrequencyMins = #{configuration_mode_frequency_mins}
76
+ RebootNodeIfNeeded = [bool]::Parse('#{reboot_if_needed}')
77
+ RefreshFrequencyMins = #{refresh_frequency_mins}
78
+ RefreshMode = '#{refresh_mode}'
79
+ }
80
+ }
81
+ LCMSETUP
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,53 +1,52 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Steven Murawski (<steven.murawski@gmail.com>)
4
- #
5
- # Copyright (C) 2014 Steven Murawski
6
- #
7
- # Licensed under the Apache 2 License.
8
- # See LICENSE for more details
9
-
10
- require "kitchen/provisioner/dsc_lcm/lcm_base"
11
-
12
- module Kitchen
13
- module Provisioner
14
- module DscLcm
15
- class LcmV4 < LcmBase
16
-
17
- def lcm_properties
18
- {
19
- :action_after_reboot => "StopConfiguration",
20
- :allow_module_overwrite => false,
21
- :certificate_id => nil,
22
- :configuration_mode => "ApplyAndAutoCorrect",
23
- :configuration_mode_frequency_mins => 30,
24
- :debug_mode => "All",
25
- :reboot_if_needed => false,
26
- :refresh_mode => "PUSH",
27
- :refresh_frequency_mins => 15
28
- }
29
- end
30
-
31
- def lcm_configuration_script
32
- <<-LCMSETUP
33
- configuration SetupLCM
34
- {
35
- LocalConfigurationManager
36
- {
37
- ActionAfterReboot = '#{action_after_reboot}'
38
- AllowModuleOverwrite = [bool]::Parse('#{allow_module_overwrite}')
39
- CertificateID = #{certificate_id}
40
- ConfigurationMode = '#{configuration_mode}'
41
- ConfigurationModeFrequencyMins = #{configuration_mode_frequency_mins}
42
- DebugMode = '#{debug_mode}'
43
- RebootNodeIfNeeded = [bool]::Parse('#{reboot_if_needed}')
44
- RefreshFrequencyMins = #{refresh_frequency_mins}
45
- RefreshMode = '#{refresh_mode}'
46
- }
47
- }
48
- LCMSETUP
49
- end
50
- end
51
- end
52
- end
53
- end
1
+ #
2
+ # Author:: Steven Murawski (<steven.murawski@gmail.com>)
3
+ #
4
+ # Copyright (C) 2014 Steven Murawski
5
+ #
6
+ # Licensed under the Apache 2 License.
7
+ # See LICENSE for more details
8
+
9
+ require_relative "lcm_base"
10
+
11
+ module Kitchen
12
+ module Provisioner
13
+ module DscLcm
14
+ class LcmV4 < LcmBase
15
+
16
+ def lcm_properties
17
+ {
18
+ action_after_reboot: "StopConfiguration",
19
+ allow_module_overwrite: false,
20
+ certificate_id: nil,
21
+ configuration_mode: "ApplyAndAutoCorrect",
22
+ configuration_mode_frequency_mins: 30,
23
+ debug_mode: "All",
24
+ reboot_if_needed: false,
25
+ refresh_mode: "PUSH",
26
+ refresh_frequency_mins: 15,
27
+ }
28
+ end
29
+
30
+ def lcm_configuration_script
31
+ <<-LCMSETUP
32
+ configuration SetupLCM
33
+ {
34
+ LocalConfigurationManager
35
+ {
36
+ ActionAfterReboot = '#{action_after_reboot}'
37
+ AllowModuleOverwrite = [bool]::Parse('#{allow_module_overwrite}')
38
+ CertificateID = #{certificate_id}
39
+ ConfigurationMode = '#{configuration_mode}'
40
+ ConfigurationModeFrequencyMins = #{configuration_mode_frequency_mins}
41
+ DebugMode = '#{debug_mode}'
42
+ RebootNodeIfNeeded = [bool]::Parse('#{reboot_if_needed}')
43
+ RefreshFrequencyMins = #{refresh_frequency_mins}
44
+ RefreshMode = '#{refresh_mode}'
45
+ }
46
+ }
47
+ LCMSETUP
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,54 +1,53 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Steven Murawski (<steven.murawski@gmail.com>)
4
- #
5
- # Copyright (C) 2014 Steven Murawski
6
- #
7
- # Licensed under the Apache 2 License.
8
- # See LICENSE for more details
9
-
10
- require "kitchen/provisioner/dsc_lcm/lcm_base"
11
-
12
- module Kitchen
13
- module Provisioner
14
- module DscLcm
15
- class LcmV5 < LcmBase
16
-
17
- def lcm_properties
18
- {
19
- :action_after_reboot => "StopConfiguration",
20
- :allow_module_overwrite => false,
21
- :certificate_id => nil,
22
- :configuration_mode => "ApplyAndAutoCorrect",
23
- :configuration_mode_frequency_mins => 15,
24
- :debug_mode => "All",
25
- :reboot_if_needed => false,
26
- :refresh_mode => "PUSH",
27
- :refresh_frequency_mins => 30
28
- }
29
- end
30
-
31
- def lcm_configuration_script
32
- <<-LCMSETUP
33
- [DSCLocalConfigurationManager()]
34
- configuration SetupLCM
35
- {
36
- Settings
37
- {
38
- ActionAfterReboot = '#{action_after_reboot}'
39
- AllowModuleOverwrite = [bool]::Parse('#{allow_module_overwrite}')
40
- CertificateID = #{certificate_id}
41
- ConfigurationMode = '#{configuration_mode}'
42
- ConfigurationModeFrequencyMins = #{configuration_mode_frequency_mins}
43
- DebugMode = '#{debug_mode}'
44
- RebootNodeIfNeeded = [bool]::Parse('#{reboot_if_needed}')
45
- RefreshFrequencyMins = #{refresh_frequency_mins}
46
- RefreshMode = '#{refresh_mode}'
47
- }
48
- }
49
- LCMSETUP
50
- end
51
- end
52
- end
53
- end
54
- end
1
+ #
2
+ # Author:: Steven Murawski (<steven.murawski@gmail.com>)
3
+ #
4
+ # Copyright (C) 2014 Steven Murawski
5
+ #
6
+ # Licensed under the Apache 2 License.
7
+ # See LICENSE for more details
8
+
9
+ require_relative "lcm_base"
10
+
11
+ module Kitchen
12
+ module Provisioner
13
+ module DscLcm
14
+ class LcmV5 < LcmBase
15
+
16
+ def lcm_properties
17
+ {
18
+ action_after_reboot: "StopConfiguration",
19
+ allow_module_overwrite: false,
20
+ certificate_id: nil,
21
+ configuration_mode: "ApplyAndAutoCorrect",
22
+ configuration_mode_frequency_mins: 15,
23
+ debug_mode: "All",
24
+ reboot_if_needed: false,
25
+ refresh_mode: "PUSH",
26
+ refresh_frequency_mins: 30,
27
+ }
28
+ end
29
+
30
+ def lcm_configuration_script
31
+ <<-LCMSETUP
32
+ [DSCLocalConfigurationManager()]
33
+ configuration SetupLCM
34
+ {
35
+ Settings
36
+ {
37
+ ActionAfterReboot = '#{action_after_reboot}'
38
+ AllowModuleOverwrite = [bool]::Parse('#{allow_module_overwrite}')
39
+ CertificateID = #{certificate_id}
40
+ ConfigurationMode = '#{configuration_mode}'
41
+ ConfigurationModeFrequencyMins = #{configuration_mode_frequency_mins}
42
+ DebugMode = '#{debug_mode}'
43
+ RebootNodeIfNeeded = [bool]::Parse('#{reboot_if_needed}')
44
+ RefreshFrequencyMins = #{refresh_frequency_mins}
45
+ RefreshMode = '#{refresh_mode}'
46
+ }
47
+ }
48
+ LCMSETUP
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
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.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Murawski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -179,33 +179,33 @@ dependencies:
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: finstyle
182
+ name: chefstyle
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - '='
186
186
  - !ruby/object:Gem::Version
187
- version: 1.4.0
187
+ version: 1.2.1
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - '='
193
193
  - !ruby/object:Gem::Version
194
- version: 1.4.0
194
+ version: 1.2.1
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: cane
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - '='
200
200
  - !ruby/object:Gem::Version
201
- version: 2.6.2
201
+ version: 3.0.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: 2.6.2
208
+ version: 3.0.0
209
209
  description: |+
210
210
  == DESCRIPTION:
211
211
 
@@ -230,9 +230,9 @@ files:
230
230
  - lib/kitchen/provisioner/dsc_lcm/lcm_v5.rb
231
231
  homepage: https://github.com/test-kitchen/kitchen-dsc
232
232
  licenses:
233
- - Apache 2
233
+ - Apache-2.0
234
234
  metadata: {}
235
- post_install_message:
235
+ post_install_message:
236
236
  rdoc_options: []
237
237
  require_paths:
238
238
  - lib
@@ -247,9 +247,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
- rubyforge_project: "[none]"
251
- rubygems_version: 2.6.11
252
- signing_key:
250
+ rubygems_version: 3.1.2
251
+ signing_key:
253
252
  specification_version: 4
254
253
  summary: PowerShell DSC provisioner for test-kitchen
255
254
  test_files: []
255
+ ...