vcloud-core 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.0.8 (2014-03-04)
2
+
3
+ Bugfix:
4
+
5
+ - missing VM bootstrap->vars section would throw NilClass error
6
+
1
7
  ## 0.0.7 (2014-03-03)
2
8
 
3
9
  Bugfixes:
@@ -1,5 +1,5 @@
1
1
  module Vcloud
2
2
  module Core
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
  end
@@ -101,7 +101,8 @@ module Vcloud
101
101
  if bootstrap_config.nil? or bootstrap_config[:script_path].nil?
102
102
  interpolated_preamble = ''
103
103
  else
104
- preamble_vars = bootstrap_config[:vars].merge(:extra_disks => extra_disks)
104
+ preamble_vars = bootstrap_config[:vars] || {}
105
+ preamble_vars.merge!(:extra_disks => extra_disks)
105
106
  interpolated_preamble = generate_preamble(
106
107
  bootstrap_config[:script_path],
107
108
  bootstrap_config[:script_post_processor],
@@ -122,6 +122,64 @@ module Vcloud
122
122
  end
123
123
  end
124
124
 
125
+ context '#configure_guest_customization_section' do
126
+
127
+ it "should handle complete configuration" do
128
+ name = 'test-vm'
129
+ bootstrap_config = {
130
+ script_path: 'hello_world.erb',
131
+ script_post_processor: 'remove_hello.rb',
132
+ vars: { bob: 'hello', mary: 'hello' },
133
+ }
134
+ extra_disks = []
135
+ @vm.should_receive(:generate_preamble).
136
+ with('hello_world.erb', 'remove_hello.rb', {
137
+ bob: "hello",
138
+ mary: "hello",
139
+ extra_disks: [] }).
140
+ and_return('RETURNED_PREAMBLE')
141
+ @fog_interface.should_receive(:put_guest_customization_section).
142
+ with(@vm_id, 'test-vm', 'RETURNED_PREAMBLE')
143
+ @vm.configure_guest_customization_section(name, bootstrap_config, extra_disks)
144
+ end
145
+
146
+ it "should handle nil configuration" do
147
+ name = 'test-vm'
148
+ bootstrap_config = nil
149
+ extra_disks = nil
150
+ @vm.should_not_receive(:generate_preamble)
151
+ @fog_interface.should_receive(:put_guest_customization_section).
152
+ with(@vm_id, 'test-vm', '')
153
+ @vm.configure_guest_customization_section(name, bootstrap_config, extra_disks)
154
+ end
155
+
156
+ it "should handle empty configuration" do
157
+ name = 'test-vm'
158
+ bootstrap_config = {}
159
+ extra_disks = nil
160
+ @vm.should_not_receive(:generate_preamble)
161
+ @fog_interface.should_receive(:put_guest_customization_section).
162
+ with(@vm_id, 'test-vm', '')
163
+ @vm.configure_guest_customization_section(name, bootstrap_config, extra_disks)
164
+ end
165
+
166
+ it "should handle bootstrap vars being missing" do
167
+ name = 'test-vm'
168
+ bootstrap_config = {
169
+ script_path: 'hello_world.erb',
170
+ script_post_processor: 'remove_hello.rb',
171
+ }
172
+ extra_disks = []
173
+ @vm.should_receive(:generate_preamble).
174
+ with('hello_world.erb', 'remove_hello.rb', { extra_disks: [] }).
175
+ and_return('RETURNED_PREAMBLE')
176
+ @fog_interface.should_receive(:put_guest_customization_section).
177
+ with(@vm_id, 'test-vm', 'RETURNED_PREAMBLE')
178
+ @vm.configure_guest_customization_section(name, bootstrap_config, extra_disks)
179
+ end
180
+
181
+ end
182
+
125
183
  context '#generate_preamble' do
126
184
  it "should interpolate vars hash into template" do
127
185
  vars = {:message => 'hello world'}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcloud-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-03 00:00:00.000000000 Z
12
+ date: 2014-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  segments:
183
183
  - 0
184
- hash: -512267274305654333
184
+ hash: 4076622022301530583
185
185
  requirements: []
186
186
  rubyforge_project:
187
187
  rubygems_version: 1.8.23