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 +6 -0
- data/lib/vcloud/core/version.rb +1 -1
- data/lib/vcloud/core/vm.rb +2 -1
- data/spec/vcloud/core/vm_spec.rb +58 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/lib/vcloud/core/version.rb
CHANGED
data/lib/vcloud/core/vm.rb
CHANGED
@@ -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]
|
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],
|
data/spec/vcloud/core/vm_spec.rb
CHANGED
@@ -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.
|
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-
|
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:
|
184
|
+
hash: 4076622022301530583
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
187
|
rubygems_version: 1.8.23
|