kitchen-hyperv 0.2.1 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d8187d14da4cc530bcbfbb5c44c4386ee2cc119
4
- data.tar.gz: 7e23e2dd069c756b6e28a553770520eb5225590c
3
+ metadata.gz: a4943e1bf989d84e45049694dfa9fcabae748992
4
+ data.tar.gz: 6c57a1373e0f713974be0917dbc4a2b3b21c6304
5
5
  SHA512:
6
- metadata.gz: 9786ad82b471d5bcb3019effc0227c135b26335bfa500de4629f46e6034ea93f9c1f60664ec2d742575e5522c264f5cbe317519496631cbe2bd201670d065505
7
- data.tar.gz: c2267765344ca3b4004304502c18138e964d22b6e762cb9da061192706711a90b3a52e2dafc13406de2fa86e056e8b2b7b0da520e9a629b3a79c4db7eaeab19f
6
+ metadata.gz: 09a93312d25a48bfa8b7601ef1f80b280950b4dc3f5d102f2ea8e3945ebbad46f9a105b847289697e07f447ce04d1ba8cde6cc34b08118f215ca4a4ee15bf9be
7
+ data.tar.gz: 3eb72a618d78f698d7bffd24db39b91f6343a1d82a540e2026f6d5ba9e9a6bf06d6eb050cdc4b91232956eaf0f26afa34990fb1a9aa8a851b40b92d9798924b7
data/CHANGELOG.md ADDED
@@ -0,0 +1,77 @@
1
+ # Change Log
2
+
3
+ ## [v0.2.2](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.2.2) (2016-06-10)
4
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.2.1...v0.2.2)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Support PowerShell v5.1 on the Insider Preview - updated [\#31](https://github.com/test-kitchen/kitchen-hyperv/pull/31) ([smurawski](https://github.com/smurawski))
9
+ - Support PowerShell v5.1 on the Insider Preview [\#30](https://github.com/test-kitchen/kitchen-hyperv/pull/30) ([smurawski](https://github.com/smurawski))
10
+
11
+ ## [v0.2.1](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.2.1) (2016-05-25)
12
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.20...v0.2.1)
13
+
14
+ ## [v0.1.20](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.20) (2016-05-17)
15
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.10...v0.1.20)
16
+
17
+ **Merged pull requests:**
18
+
19
+ - More Configurable VM Networking [\#27](https://github.com/test-kitchen/kitchen-hyperv/pull/27) ([svmastersamurai](https://github.com/svmastersamurai))
20
+ - Add -noprofile to powershell executions to prevent users' custom prof… [\#23](https://github.com/test-kitchen/kitchen-hyperv/pull/23) ([kriszentner](https://github.com/kriszentner))
21
+
22
+ ## [v0.1.10](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.10) (2015-12-03)
23
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.9...v0.1.10)
24
+
25
+ **Merged pull requests:**
26
+
27
+ - update incorrect module name [\#21](https://github.com/test-kitchen/kitchen-hyperv/pull/21) ([jbruettcva](https://github.com/jbruettcva))
28
+
29
+ ## [v0.1.9](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.9) (2015-12-03)
30
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.8...v0.1.9)
31
+
32
+ ## [v0.1.8](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.8) (2015-12-03)
33
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.7...v0.1.8)
34
+
35
+ **Merged pull requests:**
36
+
37
+ - Updating readme.md to include image configuration, specifically winrm… [\#20](https://github.com/test-kitchen/kitchen-hyperv/pull/20) ([jbruettcva](https://github.com/jbruettcva))
38
+ - Hyper-V module and Get-VMIP delay fix [\#19](https://github.com/test-kitchen/kitchen-hyperv/pull/19) ([jbruettcva](https://github.com/jbruettcva))
39
+ - File copy feature [\#17](https://github.com/test-kitchen/kitchen-hyperv/pull/17) ([dpiessens](https://github.com/dpiessens))
40
+ - Fixed NilClass exception if VM does not exist [\#16](https://github.com/test-kitchen/kitchen-hyperv/pull/16) ([dpiessens](https://github.com/dpiessens))
41
+ - Add support for dynamic memory [\#15](https://github.com/test-kitchen/kitchen-hyperv/pull/15) ([brantb](https://github.com/brantb))
42
+
43
+ ## [v0.1.7](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.7) (2015-07-14)
44
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.6...v0.1.7)
45
+
46
+ **Merged pull requests:**
47
+
48
+ - 64-bit windows support [\#8](https://github.com/test-kitchen/kitchen-hyperv/pull/8) ([ksubrama](https://github.com/ksubrama))
49
+
50
+ ## [v0.1.6](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.6) (2015-06-25)
51
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.5...v0.1.6)
52
+
53
+ ## [v0.1.5](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.5) (2015-06-24)
54
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.2...v0.1.5)
55
+
56
+ **Merged pull requests:**
57
+
58
+ - Adding support for mounting ISOs [\#6](https://github.com/test-kitchen/kitchen-hyperv/pull/6) ([smurawski](https://github.com/smurawski))
59
+
60
+ ## [v0.1.2](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.2) (2015-05-20)
61
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.1...v0.1.2)
62
+
63
+ **Merged pull requests:**
64
+
65
+ - Smurawski/updating metadata [\#4](https://github.com/test-kitchen/kitchen-hyperv/pull/4) ([smurawski](https://github.com/smurawski))
66
+
67
+ ## [v0.1.1](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.1) (2015-05-20)
68
+ [Full Changelog](https://github.com/test-kitchen/kitchen-hyperv/compare/v0.1.0...v0.1.1)
69
+
70
+ ## [v0.1.0](https://github.com/test-kitchen/kitchen-hyperv/tree/v0.1.0) (2015-05-20)
71
+ **Merged pull requests:**
72
+
73
+ - Prepping for release [\#3](https://github.com/test-kitchen/kitchen-hyperv/pull/3) ([smurawski](https://github.com/smurawski))
74
+
75
+
76
+
77
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Rakefile CHANGED
@@ -56,14 +56,13 @@ begin
56
56
  require "github_changelog_generator/task"
57
57
 
58
58
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
59
- #config.issues = false
60
59
  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(",")
60
+ config.issues = false
61
+ config.pulls = true
62
+ config.user = 'test-kitchen'
63
+ config.project = 'kitchen-hyperv'
66
64
  end
67
65
  rescue LoadError
68
- puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs"
66
+ puts "github_changelog_generator is not available. " \
67
+ "gem install github_changelog_generator to generate changelogs"
69
68
  end
@@ -79,20 +79,6 @@ module Kitchen
79
79
 
80
80
  private
81
81
 
82
- def mount_virtual_machine_iso
83
- return unless config[:iso_path]
84
- info("Mounting #{config[:iso_path]}")
85
- run_ps mount_vm_iso
86
- end
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
-
96
82
  def validate_vm_settings
97
83
  raise "Missing parent_vhd_folder" unless vhd_folder?
98
84
  raise "Missing parent_vhd_name" unless vhd?
@@ -108,6 +94,13 @@ module Kitchen
108
94
  config[:vm_switch] = vm_switch
109
95
  end
110
96
 
97
+ def create_new_differencing_disk
98
+ return if File.exist? differencing_disk_path
99
+ info("Creating differencing disk for #{instance.name}.")
100
+ run_ps new_differencing_disk_ps
101
+ info("Created differencing disk for #{instance.name}.")
102
+ end
103
+
111
104
  def vm_switch
112
105
  default_switch_object = run_ps vm_default_switch_ps
113
106
  if default_switch_object.nil? ||
@@ -118,20 +111,39 @@ module Kitchen
118
111
  default_switch_object['Name']
119
112
  end
120
113
 
121
- def kitchen_vm_path
122
- @kitchen_vm_path ||= File.join(config[:kitchen_root], ".kitchen/#{instance.name}")
114
+ def create_virtual_machine
115
+ return if vm_exists
116
+ info("Creating virtual machine for #{instance.name}.")
117
+ new_vm_object = run_ps new_vm_ps
118
+ @state[:id] = new_vm_object['Id']
119
+ info("Created virtual machine for #{instance.name}.")
123
120
  end
124
121
 
125
- def boot_iso_path
126
- @boot_iso_path ||= config[:boot_iso_path]
122
+ def update_state
123
+ vm_details
124
+ @state[:id] = @vm['Id']
125
+ @state[:hostname] = @vm['IpAddress']
126
+ @state[:vm_name] = @vm['Name']
127
127
  end
128
128
 
129
- def differencing_disk_path
130
- @differencing_disk_path ||= File.join(kitchen_vm_path, "diff" + "#{config[:disk_type]}")
129
+ def vm_details
130
+ run_ps set_vm_ipaddress_ps if config[:ip_address]
131
+ @vm = run_ps vm_details_ps
131
132
  end
132
133
 
133
- def parent_vhd_path
134
- @parent_vhd_path ||= File.join(config[:parent_vhd_folder], config[:parent_vhd_name])
134
+ def mount_virtual_machine_iso
135
+ return unless config[:iso_path]
136
+ info("Mounting #{config[:iso_path]}")
137
+ run_ps mount_vm_iso
138
+ end
139
+
140
+ def copy_vm_files
141
+ return if config[:copy_vm_files].nil?
142
+ info("Copying files to virtual machine")
143
+ config[:copy_vm_files].each do |file_info|
144
+ run_ps copy_vm_file_ps(file_info[:source], file_info[:dest])
145
+ end
146
+ info("Copied files to virtual machine")
135
147
  end
136
148
 
137
149
  def vm_exists
@@ -143,53 +155,55 @@ module Kitchen
143
155
  true
144
156
  end
145
157
 
158
+ def remove_virtual_machine
159
+ info("Deleting virtual machine for #{instance.name}")
160
+ run_ps delete_vm_ps
161
+ info("Deleted virtual machine for #{instance.name}")
162
+ end
163
+
146
164
  def remove_differencing_disk
147
165
  info("Removing the differencing disk for #{instance.name}.")
148
166
  FileUtils.rm(differencing_disk_path)
149
167
  info("Removed the differencing disk for #{instance.name}.")
150
168
  end
151
169
 
152
- def create_new_differencing_disk
153
- return if File.exist? differencing_disk_path
154
- info("Creating differencing disk for #{instance.name}.")
155
- run_ps new_differencing_disk_ps
156
- info("Created differencing disk for #{instance.name}.")
170
+ def kitchen_vm_path
171
+ @kitchen_vm_path ||= File.join(config[:kitchen_root], ".kitchen/#{instance.name}")
157
172
  end
158
173
 
159
- def remove_virtual_machine
160
- info("Deleting virtual machine for #{instance.name}")
161
- run_ps delete_vm_ps
162
- info("Deleted virtual machine for #{instance.name}")
174
+ def boot_iso_path
175
+ @boot_iso_path ||= config[:boot_iso_path]
163
176
  end
164
177
 
165
- def create_virtual_machine
166
- return if vm_exists
167
- info("Creating virtual machine for #{instance.name}.")
168
- new_vm_object = run_ps new_vm_ps
169
- @state[:id] = new_vm_object['Id']
170
- info("Created virtual machine for #{instance.name}.")
178
+ def differencing_disk_path
179
+ @differencing_disk_path ||= File.join(kitchen_vm_path, "diff" + "#{config[:disk_type]}")
171
180
  end
172
181
 
173
- def copy_vm_files
174
- return if config[:copy_vm_files].nil?
175
- info("Copying files to virtual machine")
176
- config[:copy_vm_files].each do |file_info|
177
- run_ps copy_vm_file_ps(file_info[:source], file_info[:dest])
178
- end
179
- info("Copied files to virtual machine")
182
+ def parent_vhd_path
183
+ @parent_vhd_path ||= File.join(config[:parent_vhd_folder], config[:parent_vhd_name])
180
184
  end
181
185
 
182
- def update_state
183
- vm_details
184
- @state[:id] = @vm['Id']
185
- @state[:hostname] = @vm['IpAddress']
186
- @state[:vm_name] = @vm['Name']
186
+ def vhd_folder?
187
+ config[:parent_vhd_folder] && Dir.exist?(config[:parent_vhd_folder])
187
188
  end
188
189
 
189
- def vm_details
190
- run_ps set_vm_ipaddress_ps if config[:ip_address]
191
- @vm = run_ps vm_details_ps
190
+ def vhd?
191
+ config[:parent_vhd_name] && File.exist?(parent_vhd_path)
192
192
  end
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
193
207
  end
194
208
  end
195
209
  end
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Kitchen
19
19
  module Driver
20
- HYPERV_VERSION = '0.2.1'
20
+ HYPERV_VERSION = '0.2.3'.freeze
21
21
  end
22
22
  end
@@ -29,11 +29,18 @@ module Kitchen
29
29
 
30
30
  def is_64bit?
31
31
  os_arch = ENV['PROCESSOR_ARCHITEW6432'] || ENV['PROCESSOR_ARCHITECTURE']
32
- os_arch == 'AMD64'
32
+ ruby_arch = ['foo'].pack('p').size == 4 ? 32 : 64
33
+ os_arch == 'AMD64' && ruby_arch == 64
34
+ end
35
+
36
+ def is_32bit?
37
+ os_arch = ENV['PROCESSOR_ARCHITEW6432'] || ENV['PROCESSOR_ARCHITECTURE']
38
+ ruby_arch = ['foo'].pack('p').size == 4 ? 32 : 64
39
+ os_arch != 'AMD64' && ruby_arch == 32
33
40
  end
34
41
 
35
42
  def powershell_64_bit
36
- if is_64bit?
43
+ if is_64bit? || is_32bit?
37
44
  'c:\windows\system32\windowspowershell\v1.0\powershell.exe'
38
45
  else
39
46
  'c:\windows\sysnative\windowspowershell\v1.0\powershell.exe'
@@ -43,7 +50,7 @@ module Kitchen
43
50
  def wrap_command(script)
44
51
  base_script_path = File.join(File.dirname(__FILE__), '/../../../support/hyperv.ps1')
45
52
  debug("Loading functions from #{base_script_path}")
46
- new_script = ". #{base_script_path}; " << script
53
+ new_script = [ ". #{base_script_path}", "#{script}" ].join(";\n")
47
54
  debug("Wrapped script: #{new_script}")
48
55
  "#{powershell_64_bit} -noprofile -executionpolicy bypass" \
49
56
  " -encodedcommand #{encode_command new_script} -outputformat Text"
@@ -69,7 +76,12 @@ module Kitchen
69
76
  sh.run_command
70
77
  debug("Local Command END #{Util.duration(sh.execution_time)}")
71
78
  raise "Failed: #{sh.stderr}" if sh.error?
72
- JSON.parse(sh.stdout) if sh.stdout.length > 2
79
+ stdout = sanitize_stdout(sh.stdout)
80
+ JSON.parse(stdout) if stdout.length > 2
81
+ end
82
+
83
+ def sanitize_stdout(stdout)
84
+ stdout.split("\n").select { |s| !s.start_with?("PS") }.join("\n")
73
85
  end
74
86
 
75
87
  def new_differencing_disk_ps
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-hyperv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Murawski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -146,8 +146,8 @@ files:
146
146
  - ".cane"
147
147
  - ".gitignore"
148
148
  - ".rubocop.yml"
149
+ - CHANGELOG.md
149
150
  - Gemfile
150
- - HISTORY.md
151
151
  - LICENSE.txt
152
152
  - README.md
153
153
  - Rakefile
data/HISTORY.md DELETED
@@ -1,21 +0,0 @@
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