kitchen-dsc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +11 -0
- data/kitchen-dsc.gemspec +30 -0
- data/lib/kitchen/provisioner/dsc.rb +95 -0
- data/lib/kitchen-dsc/version.rb +7 -0
- metadata +57 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7648a4ce929eaf9c6ae05202aea0eafd81ea4f0e
|
|
4
|
+
data.tar.gz: 1f1b628411d96a2f6ab322510895fc0485d2b509
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c4a102df223ea3d82587ea183b9d5dcd4db457ebed2bb8943a3179709533c9cbf644de3f8f7472ce60e8690a99f80870b1bea63c4f8811d0628bd3e34956698b
|
|
7
|
+
data.tar.gz: 4885e2f4d9785d442887fcd871823f707320b226d3bf2fde27052bed4ce4804629d3f0a9d6cba0ea676358e648fcfaaf3cf3e5bf3a7aa1d88813e52039f4bdb0
|
data/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# kitchen-dsc
|
|
2
|
+
A Test Kitchen Provisioner for PowerShell DSC
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
You'll need a driver box with WMF4 or greater (ONLY WINDOWS SYSTEMS)
|
|
7
|
+
|
|
8
|
+
## Installation & Setup
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
## Example Configuration
|
data/kitchen-dsc.gemspec
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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 = ['steven.murawski@gmail.com']
|
|
11
|
+
s.homepage = 'https://github.com/smurawski/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 = 'MIT'
|
|
19
|
+
s.description = <<-EOF
|
|
20
|
+
== DESCRIPTION:
|
|
21
|
+
|
|
22
|
+
DSC Provisioner for Test Kitchen
|
|
23
|
+
|
|
24
|
+
== FEATURES:
|
|
25
|
+
|
|
26
|
+
TBD
|
|
27
|
+
|
|
28
|
+
EOF
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
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 MIT License.
|
|
8
|
+
# See LICENSE for more details
|
|
9
|
+
|
|
10
|
+
require 'fileutils'
|
|
11
|
+
require 'pathname'
|
|
12
|
+
require 'kitchen/provisioner/base'
|
|
13
|
+
require 'kitchen/util'
|
|
14
|
+
|
|
15
|
+
module Kitchen
|
|
16
|
+
|
|
17
|
+
module Provisioner
|
|
18
|
+
class Dsc < Base
|
|
19
|
+
|
|
20
|
+
kitchen_provisioner_api_version 2
|
|
21
|
+
|
|
22
|
+
attr_accessor :tmp_dir
|
|
23
|
+
|
|
24
|
+
default_config :modules_path, 'modules'
|
|
25
|
+
default_config :configuration_script, 'dsc_configuration.ps1'
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
default_config :dsc_local_configuration_manager, {
|
|
29
|
+
:wmf4 => {
|
|
30
|
+
:reboot_if_needed => false
|
|
31
|
+
},
|
|
32
|
+
:wmf5 => {
|
|
33
|
+
:reboot_if_needed => false,
|
|
34
|
+
:debug_mode => false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
def install_command
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def init_command
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def create_sandbox
|
|
45
|
+
super
|
|
46
|
+
FileUtils.mkdir_p(sandbox_path)
|
|
47
|
+
|
|
48
|
+
info('Staging DSC Resource Modules for copy to the SUT')
|
|
49
|
+
FileUtils.cp_r(File.join(config[:kitchen_root], config[:modules_path]), File.join(sandbox_path, 'modules'))
|
|
50
|
+
FileUtils.cp(File.join(config[:kitchen_root], config[:configuration_script]), File.join(sandbox_path, 'dsc_configuration.ps1'))
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def prepare_command
|
|
54
|
+
info('Moving DSC Resources onto PSModulePath')
|
|
55
|
+
info("Generating the MOF script for the configuration #{current_configuration}")
|
|
56
|
+
|
|
57
|
+
stage_resources_and_generate_mof_script = <<-EOH
|
|
58
|
+
|
|
59
|
+
dir ( join-path #{config[:root_path]} 'modules/*') -directory |
|
|
60
|
+
copy-item -destination $env:programfiles/windowspowershell/modules/ -recurse -force
|
|
61
|
+
|
|
62
|
+
mkdir 'c:/configurations' | out-null
|
|
63
|
+
. #{remote_path_join( config[:root_path], config[:configuration_script])}
|
|
64
|
+
#{current_configuration} -outputpath c:/configurations | out-null
|
|
65
|
+
|
|
66
|
+
EOH
|
|
67
|
+
|
|
68
|
+
wrap_shell_code(stage_resources_and_generate_mof_script)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def run_command
|
|
72
|
+
info("Running the configuration #{current_configuration}")
|
|
73
|
+
run_configuration_script = <<-EOH
|
|
74
|
+
|
|
75
|
+
$job = start-dscconfiguration -Path c:/configurations/
|
|
76
|
+
$job | wait-job
|
|
77
|
+
$job.childjobs[0].verbose
|
|
78
|
+
|
|
79
|
+
EOH
|
|
80
|
+
wrap_shell_code(run_configuration_script)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
def current_configuration
|
|
86
|
+
config.keys.include?(:run_list) ? config[:run_list][0] : @instance.suite.name
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def is_resource_module?
|
|
90
|
+
#TODO
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: kitchen-dsc
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Steven Murawski
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: |+
|
|
14
|
+
== DESCRIPTION:
|
|
15
|
+
|
|
16
|
+
DSC Provisioner for Test Kitchen
|
|
17
|
+
|
|
18
|
+
== FEATURES:
|
|
19
|
+
|
|
20
|
+
TBD
|
|
21
|
+
|
|
22
|
+
email:
|
|
23
|
+
- steven.murawski@gmail.com
|
|
24
|
+
executables: []
|
|
25
|
+
extensions: []
|
|
26
|
+
extra_rdoc_files: []
|
|
27
|
+
files:
|
|
28
|
+
- README.md
|
|
29
|
+
- kitchen-dsc.gemspec
|
|
30
|
+
- lib/kitchen-dsc/version.rb
|
|
31
|
+
- lib/kitchen/provisioner/dsc.rb
|
|
32
|
+
homepage: https://github.com/smurawski/kitchen-dsc
|
|
33
|
+
licenses:
|
|
34
|
+
- MIT
|
|
35
|
+
metadata: {}
|
|
36
|
+
post_install_message:
|
|
37
|
+
rdoc_options: []
|
|
38
|
+
require_paths:
|
|
39
|
+
- lib
|
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - '>='
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '0'
|
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - '>='
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '0'
|
|
50
|
+
requirements: []
|
|
51
|
+
rubyforge_project: '[none]'
|
|
52
|
+
rubygems_version: 2.4.4
|
|
53
|
+
signing_key:
|
|
54
|
+
specification_version: 4
|
|
55
|
+
summary: PowerShell DSC provisioner for test-kitchen
|
|
56
|
+
test_files: []
|
|
57
|
+
has_rdoc:
|