kitchen-hyperv 0.1.20 → 0.2.0

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
2
  SHA1:
3
- metadata.gz: c1d4f93b043b3ffd049677de50956792b767beef
4
- data.tar.gz: 16273be77c92281545407b43f51d8e47c5de8155
3
+ metadata.gz: 7fe9d9ccb046b8b131cfd899f51d4b3e804a4785
4
+ data.tar.gz: 0d10faf30ad3ce73c07231e41fce9a5216d1929d
5
5
  SHA512:
6
- metadata.gz: feb8ed661a0989544fe2a1e1fc5030e0fb24f614da9a19ac85812c8aa5013f5aef5eb240b4a483155088eca8bb529ec523a56773d70318941b42e350ae41d700
7
- data.tar.gz: 7d01d62bb019ba9b44d830742e8809857e89b8030503e71745e875fa5526df78a00e1f5339a8ce610c373c78b9c3cbc97bfecc3ae73556e8617ab34d0a054a7f
6
+ metadata.gz: 6deb6cbcae9d5b8c7c69277b82bd6b4577db267256e4c48fd627d57da4022fcb7f36d71b1ec28dc0f9794246d5d20b722239ee4893efaa76dcc7923c17691f6a
7
+ data.tar.gz: 1a6092559b6c67e6f7caaa2a79089f4a7e7bf1d3d652a59c281f6efa46836c56cd3af0a9c69fbc207d7785b482b0881552f4e721e8760cb1bbe838b9ef7a4a01
data/.cane CHANGED
@@ -1,2 +1,2 @@
1
- --no-doc
1
+ --no-doc
2
2
  --style-measure 100
data/.gitignore CHANGED
@@ -1,15 +1,15 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
15
- *.gem
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.gem
data/Gemfile CHANGED
@@ -1,10 +1,15 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in kitchen-hyperv.gemspec
4
- gemspec
5
-
6
- gem 'win32-process'
7
- gem 'win32-api'
8
- gem 'windows-pr'
9
- gem 'windows-api'
10
- gem 'ffi'
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kitchen-hyperv.gemspec
4
+ gemspec
5
+
6
+ gem 'win32-process'
7
+ gem 'win32-api'
8
+ gem 'windows-pr'
9
+ gem 'windows-api'
10
+ gem 'ffi'
11
+ gem 'rb-readline'
12
+ gem 'pry'
13
+ gem 'pry-stack_explorer'
14
+ gem 'pry-byebug'
15
+ gem 'github_changelog_generator'
@@ -1,21 +1,21 @@
1
- # 0.1.10 / 12-03-2015
2
-
3
- I really need to add some tests to this project. ;)
4
-
5
- * [PR #21](https://github.com/test-kitchen/kitchen-hyperv/pull/21) : Wrong module name
6
-
7
-
8
- # 0.1.9 / 12-03-2015
9
-
10
- Missed a merge conflict.
11
-
12
- # 0.1.8 / 12-03-2015
13
-
14
- * [PR #15](https://github.com/test-kitchen/kitchen-hyperv/pull/15) : Dynamic Memory support
15
- * [PR #17](https://github.com/test-kitchen/kitchen-hyperv/pull/17) : File copy support
16
- * [PR #19](https://github.com/test-kitchen/kitchen-hyperv/pull/19) : Explict import of hyper-v module and delay in getting ip (wait for DHCP)
17
- * [PR #20](https://github.com/test-kitchen/kitchen-hyperv/pull/20) : Doc the required WinRM Settings
18
-
19
- # 0.1.7 / 07-14-2015
20
-
21
- * [PR #8](https://github.com/test-kitchen/kitchen-hyperv/pull/8) : Add support for 64 bit ruby
1
+ # 0.1.10 / 12-03-2015
2
+
3
+ I really need to add some tests to this project. ;)
4
+
5
+ * [PR #21](https://github.com/test-kitchen/kitchen-hyperv/pull/21) : Wrong module name
6
+
7
+
8
+ # 0.1.9 / 12-03-2015
9
+
10
+ Missed a merge conflict.
11
+
12
+ # 0.1.8 / 12-03-2015
13
+
14
+ * [PR #15](https://github.com/test-kitchen/kitchen-hyperv/pull/15) : Dynamic Memory support
15
+ * [PR #17](https://github.com/test-kitchen/kitchen-hyperv/pull/17) : File copy support
16
+ * [PR #19](https://github.com/test-kitchen/kitchen-hyperv/pull/19) : Explict import of hyper-v module and delay in getting ip (wait for DHCP)
17
+ * [PR #20](https://github.com/test-kitchen/kitchen-hyperv/pull/20) : Doc the required WinRM Settings
18
+
19
+ # 0.1.7 / 07-14-2015
20
+
21
+ * [PR #8](https://github.com/test-kitchen/kitchen-hyperv/pull/8) : Add support for 64 bit ruby
data/LICENSE.txt CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2015 Steven Murawski
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.
1
+ Copyright (c) 2015 Steven Murawski
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 CHANGED
@@ -49,6 +49,8 @@ driver:
49
49
  * The virtual switch to attach the guest VMs. Defaults to the first switch returned from Get-VMSwitch.
50
50
  * iso_path
51
51
  * Path on the host to the ISO to mount on the VMs.
52
+ * boot_iso_path
53
+ * Path on the host to the ISO to mount before starting the VMs.
52
54
  * vm_generation
53
55
  * The generation for the hyper-v VM. Defaults to 1.
54
56
  * disk_type
data/Rakefile CHANGED
@@ -1,52 +1,69 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- require "bundler/gem_tasks"
4
-
5
- require "rake/testtask"
6
- Rake::TestTask.new(:unit) do |t|
7
- t.libs.push "lib"
8
- t.test_files = FileList["spec/**/*_spec.rb"]
9
- t.verbose = true
10
- end
11
-
12
- desc "Run all test suites"
13
- task :test => [:unit]
14
-
15
- desc "Display LOC stats"
16
- task :stats do
17
- puts "\n## Production Code Stats"
18
- sh "countloc -r lib"
19
- puts "\n## Test Code Stats"
20
- sh "countloc -r spec"
21
- end
22
-
23
- require "finstyle"
24
- require "rubocop/rake_task"
25
- RuboCop::RakeTask.new(:style) do |task|
26
- task.options << "--display-cop-names"
27
- task.options << "--lint"
28
- task.options << '--config' << '.rubocop.yml'
29
- task.patterns = ['lib/**/*.rb']
30
- end
31
-
32
- require "cane/rake_task"
33
- desc "Run cane to check quality metrics"
34
- Cane::RakeTask.new do |cane|
35
- cane.canefile = "./.cane"
36
- end
37
-
38
- desc "Run all quality tasks"
39
- task :quality => [:cane, :style, :stats]
40
-
41
- require "yard"
42
- YARD::Rake::YardocTask.new
43
-
44
- desc "Generate gem dependency graph"
45
- task :viz do
46
- Bundler.with_clean_env do
47
- sh "bundle viz --without test development guard " \
48
- "--requirements --version"
49
- end
50
- end
51
-
52
- task :default => [:test, :quality]
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require "bundler/gem_tasks"
4
+ require "kitchen/driver/hyperv_version"
5
+
6
+ require "rake/testtask"
7
+ Rake::TestTask.new(:unit) do |t|
8
+ t.libs.push "lib"
9
+ t.test_files = FileList["spec/**/*_spec.rb"]
10
+ t.verbose = true
11
+ end
12
+
13
+ desc "Run all test suites"
14
+ task :test => [:unit]
15
+
16
+ desc "Display LOC stats"
17
+ task :stats do
18
+ puts "\n## Production Code Stats"
19
+ sh "countloc -r lib"
20
+ puts "\n## Test Code Stats"
21
+ sh "countloc -r spec"
22
+ end
23
+
24
+ require "finstyle"
25
+ require "rubocop/rake_task"
26
+ RuboCop::RakeTask.new(:style) do |task|
27
+ task.options << "--display-cop-names"
28
+ task.options << "--lint"
29
+ task.options << '--config' << '.rubocop.yml'
30
+ task.patterns = ['lib/**/*.rb']
31
+ end
32
+
33
+ require "cane/rake_task"
34
+ desc "Run cane to check quality metrics"
35
+ Cane::RakeTask.new do |cane|
36
+ cane.canefile = "./.cane"
37
+ end
38
+
39
+ desc "Run all quality tasks"
40
+ task :quality => [:cane, :style, :stats]
41
+
42
+ require "yard"
43
+ YARD::Rake::YardocTask.new
44
+
45
+ desc "Generate gem dependency graph"
46
+ task :viz do
47
+ Bundler.with_clean_env do
48
+ sh "bundle viz --without test development guard " \
49
+ "--requirements --version"
50
+ end
51
+ end
52
+
53
+ task :default => [:test, :quality]
54
+
55
+ begin
56
+ require "github_changelog_generator/task"
57
+
58
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
59
+ #config.issues = false
60
+ config.future_release = "v#{Kitchen::Driver::HYPERV_VERSION}"
61
+ config.since_tag = "v0.1.10"
62
+ config.token = ENV["GITHUB_TOKEN"]
63
+ #config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
64
+ #config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
65
+ #config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion".split(",")
66
+ end
67
+ rescue LoadError
68
+ puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs"
69
+ end
@@ -1,31 +1,32 @@
1
- # encoding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- require 'kitchen/driver/hyperv_version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "kitchen-hyperv"
9
- spec.version = Kitchen::Driver::HYPERV_VERSION
10
- spec.authors = ["Steven Murawski"]
11
- spec.email = ["steven.murawski@gmail.com"]
12
- spec.summary = 'Hyper-V Driver for Test-Kitchen'
13
- spec.description = 'Hyper-V Driver for Test-Kitchen'
14
- spec.homepage = "https://github.com/test-kitchen/kitchen-hyperv"
15
- spec.license = "Apache 2"
16
-
17
- spec.files = `git ls-files -z`.split("\x0")
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_development_dependency "bundler", "~> 1.7"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "pry", "~> 0.10"
25
- spec.add_development_dependency "cane"
26
- spec.add_development_dependency "finstyle"
27
- spec.add_development_dependency "rubocop"
28
- spec.add_development_dependency "yard"
29
-
30
- spec.add_dependency "test-kitchen", "~> 1.4"
31
- end
1
+ # encoding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'kitchen/driver/hyperv_version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "kitchen-hyperv"
9
+ spec.version = Kitchen::Driver::HYPERV_VERSION
10
+ spec.authors = ["Steven Murawski"]
11
+ spec.email = ["steven.murawski@gmail.com"]
12
+ spec.summary = 'Hyper-V Driver for Test-Kitchen'
13
+ spec.description = 'Hyper-V Driver for Test-Kitchen'
14
+ spec.homepage = "https://github.com/test-kitchen/kitchen-hyperv"
15
+ spec.license = "Apache 2"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "pry", "~> 0.10"
25
+ spec.add_development_dependency "cane"
26
+ spec.add_development_dependency "finstyle"
27
+ spec.add_development_dependency "rubocop"
28
+ spec.add_development_dependency "yard"
29
+ spec.add_development_dependency "countloc"
30
+
31
+ spec.add_dependency "test-kitchen", "~> 1.4"
32
+ end
@@ -47,6 +47,7 @@ module Kitchen
47
47
  default_config :subnet, '255.255.255.0'
48
48
  default_config :vm_switch
49
49
  default_config :iso_path
50
+ default_config :boot_iso_path
50
51
  default_config :vm_generation, 1
51
52
  default_config :disk_type do |driver|
52
53
  File.extname(driver[:parent_vhd_name])
@@ -84,24 +85,47 @@ module Kitchen
84
85
  run_ps mount_vm_iso
85
86
  end
86
87
 
88
+ def vhd_folder?
89
+ config[:parent_vhd_folder] && Dir.exist?(config[:parent_vhd_folder])
90
+ end
91
+
92
+ def vhd?
93
+ config[:parent_vhd_name] && File.exist?(parent_vhd_path)
94
+ end
95
+
87
96
  def validate_vm_settings
88
- raise "Missing parent_vhd_folder" unless config[:parent_vhd_folder]
89
- raise "Missing parent_vhd_name" unless config[:parent_vhd_name]
97
+ raise "Missing parent_vhd_folder" unless vhd_folder?
98
+ raise "Missing parent_vhd_name" unless vhd?
90
99
  if config[:dynamic_memory]
91
100
  startup_bytes = config[:memory_startup_bytes]
92
101
  min = config[:dynamic_memory_min_bytes]
93
102
  max = config[:dynamic_memory_max_bytes]
94
103
  memory_valid = startup_bytes.between?(min, max)
95
- raise "memory_startup_bytes (#{startup_bytes}) must fall within dynamic memory range (#{min}-#{max})" unless memory_valid
104
+ warning = "memory_startup_bytes (#{startup_bytes}) must" /
105
+ " fall within dynamic memory range (#{min}-#{max})"
106
+ raise warning unless memory_valid
107
+ end
108
+ config[:vm_switch] = vm_switch
109
+ end
110
+
111
+ def vm_switch
112
+ default_switch_object = run_ps vm_default_switch_ps
113
+ if default_switch_object.nil? ||
114
+ !default_switch_object.key?('Name') ||
115
+ default_switch_object['Name'].empty?
116
+ raise "Failed to find a default VM Switch."
96
117
  end
97
- return if config[:vm_switch]
98
- config[:vm_switch] = (run_ps vm_default_switch_ps)['Name']
118
+ default_switch_object['Name']
99
119
  end
100
120
 
101
121
  def kitchen_vm_path
102
122
  @kitchen_vm_path ||= File.join(config[:kitchen_root], ".kitchen/#{instance.name}")
103
123
  end
104
124
 
125
+ def boot_iso_path
126
+ @boot_iso_path ||= config[:boot_iso_path]
127
+ end
128
+
105
129
  def differencing_disk_path
106
130
  @differencing_disk_path ||= File.join(kitchen_vm_path, "diff" + "#{config[:disk_type]}")
107
131
  end
@@ -116,8 +140,7 @@ module Kitchen
116
140
  existing_vm = run_ps ensure_vm_running_ps
117
141
  return false if existing_vm.nil? || existing_vm['Id'].nil?
118
142
  info("Found an exising VM with an ID: #{existing_vm['Id']}")
119
- return true
120
- #fail('Failed to start existing VM.')
143
+ true
121
144
  end
122
145
 
123
146
  def remove_differencing_disk
@@ -146,9 +169,8 @@ module Kitchen
146
169
  @state[:id] = new_vm_object['Id']
147
170
  info("Created virtual machine for #{instance.name}.")
148
171
  end
149
-
172
+
150
173
  def copy_vm_files
151
-
152
174
  return if config[:copy_vm_files].nil?
153
175
  info("Copying files to virtual machine")
154
176
  config[:copy_vm_files].each do |file_info|
@@ -1,22 +1,22 @@
1
- #
2
- # Author:: Steven Murawski <smurawski@chef.io>
3
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- module Kitchen
19
- module Driver
20
- HYPERV_VERSION = '0.1.20'
21
- end
22
- end
1
+ #
2
+ # Author:: Steven Murawski <smurawski@chef.io>
3
+ # Copyright:: Copyright (c) 2015 Chef Software, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ module Kitchen
19
+ module Driver
20
+ HYPERV_VERSION = '0.2.0'
21
+ end
22
+ end