windows_chef_zero 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bdac58bf2e01662f4e231accb74c29e821a61d4d
4
+ data.tar.gz: 62cf973945a8f7eec2eb988ba55be10543cf8a7d
5
+ SHA512:
6
+ metadata.gz: 6c32538c9f6f68c9b3b2e7fb381cb9c8e83a1ac54853bfc3bebaebaa2e53fbad38602e713c4a49fc9e01a355c111e02469fb0fb380acbbe8579ffacf44cce5ab
7
+ data.tar.gz: c311bc13370a81d5b3f826e212295197b7d77cfa5d13b9769c686320c31225495cf3bacd2a3810d98ba005d86d43b006c296e7bd68786230a380cfb2e09b519e
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in windows_chef_zero.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Sean Porter
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # WindowsChefZero
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Requirements
6
+
7
+ https://github.com/joefitzgerald/packer-windows
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'windows_chef_zero'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install windows_chef_zero
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it ( https://github.com/[my-github-username]/windows_chef_zero/fork )
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,81 @@
1
+ require 'kitchen/provisioner/chef_zero'
2
+
3
+ module Kitchen
4
+
5
+ module Provisioner
6
+
7
+ # Windows Chef Zero provisioner.
8
+ #
9
+ # @author Sean Porter <portertech@gmail.com>
10
+ class WindowsChefZero < ChefZero
11
+
12
+ default_config :sudo, false
13
+ default_config :require_chef_omnibus, false
14
+ default_config :windows_root_path, 'C:\Windows\Temp\kitchen'
15
+ default_config :windows_chef_bindir, 'C:\opscode\chef\bin'
16
+
17
+ def create_sandbox
18
+ super
19
+ prepare_chef_client_zero_rb
20
+ prepare_validation_pem
21
+ prepare_client_rb
22
+ prepare_run_script
23
+ end
24
+
25
+ def run_command
26
+ File.join(config[:root_path], "run_client.bat")
27
+ end
28
+
29
+ private
30
+
31
+ def default_config_rb
32
+ root = config[:windows_root_path]
33
+
34
+ {
35
+ :node_name => instance.name,
36
+ :checksum_path => "#{root}\\checksums",
37
+ :file_cache_path => "#{root}\\cache",
38
+ :file_backup_path => "#{root}\\backup",
39
+ :cookbook_path => ["#{root}\\cookbooks", "#{root}\\site-cookbooks"],
40
+ :data_bag_path => "#{root}\\data_bags",
41
+ :environment_path => "#{root}\\environments",
42
+ :node_path => "#{root}\\nodes",
43
+ :role_path => "#{root}\\roles",
44
+ :client_path => "#{root}\\clients",
45
+ :user_path => "#{root}\\users",
46
+ :validation_key => "#{root}\\validation.pem",
47
+ :client_key => "#{root}\\client.pem",
48
+ :chef_server_url => "http://127.0.0.1:8889",
49
+ :encrypted_data_bag_secret => "#{root}\\encrypted_data_bag_secret",
50
+ }
51
+ end
52
+
53
+ def format_config_file(data)
54
+ data.each.map { |attr, value|
55
+ [attr, (value.is_a?(Array) ? value.to_s : %{'#{value}'})].join(" ")
56
+ }.join("\n")
57
+ end
58
+
59
+ def windows_run_command
60
+ cmd = ["#{config[:windows_chef_bindir]}\\chef-client -z"]
61
+ args = [
62
+ "--config #{config[:windows_root_path]}\\client.rb",
63
+ "--log_level #{config[:log_level]}"
64
+ ]
65
+ if config[:chef_zero_port]
66
+ args << "--chef-zero-port #{config[:chef_zero_port]}"
67
+ end
68
+ if config[:json_attributes]
69
+ args << "--json-attributes #{config[:windows_root_path]}\\dna.json"
70
+ end
71
+ (cmd + args).join(" ")
72
+ end
73
+
74
+ def prepare_run_script
75
+ File.open(File.join(sandbox_path, "run_client.bat"), "wb") do |file|
76
+ file.write(windows_run_command)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "windows_chef_zero"
5
+ spec.version = "0.1.0"
6
+ spec.authors = ["Sean Porter"]
7
+ spec.email = ["portertech@gmail.com"]
8
+ spec.summary = "A Test-Kitchen Chef Zero provisioner for Windows"
9
+ spec.description = "A Test-Kitchen Chef Zero provisioner for Windows"
10
+ spec.homepage = "https://github.com/portertech/windows_chef_zero"
11
+ spec.license = "MIT"
12
+
13
+ spec.files = `git ls-files -z`.split("\x0")
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_dependency "test-kitchen"
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: windows_chef_zero
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sean Porter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-kitchen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A Test-Kitchen Chef Zero provisioner for Windows
56
+ email:
57
+ - portertech@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/kitchen/provisioner/windows_chef_zero.rb
68
+ - windows_chef_zero.gemspec
69
+ homepage: https://github.com/portertech/windows_chef_zero
70
+ licenses:
71
+ - MIT
72
+ metadata: {}
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubyforge_project:
89
+ rubygems_version: 2.2.0
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: A Test-Kitchen Chef Zero provisioner for Windows
93
+ test_files: []