ovirt 0.7.0 → 0.7.1
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 +4 -4
- data/lib/ovirt/api.rb +1 -1
- data/lib/ovirt/service.rb +9 -1
- data/lib/ovirt/version.rb +1 -1
- data/lib/ovirt/vm.rb +1 -2
- data/spec/service_spec.rb +12 -0
- data/spec/vm_spec.rb +48 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71f1b7bb31e4d2232067a664b1a7c69b89ef97f1
|
4
|
+
data.tar.gz: f64da9916927aab357ba1b3afb33584f41edc5ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f00947dba22ddf24e1ed1e1653aa02b1b7a8b5aaccbac6af1dd4d206f80a737fe4acd716b1b8c207b6fe4ddc6b04a86a32f989ae31d278b67b6648be88925522
|
7
|
+
data.tar.gz: add18edf2497bad5478a0dfced3d550332b0e5ada97e88d1702666e64c1404e02d621a49552c82c7f9fdeb267dcc79dc36a8fcf9f0109519903450c582daec9d
|
data/lib/ovirt/api.rb
CHANGED
@@ -2,7 +2,7 @@ module Ovirt
|
|
2
2
|
class Api < Base
|
3
3
|
def self.parse_node_extended(node, hash)
|
4
4
|
parse_first_node(node, :product_info, hash,
|
5
|
-
:node => [:name, :vendor])
|
5
|
+
:node => [:name, :vendor, :full_version])
|
6
6
|
|
7
7
|
parse_first_node_with_hash(node, 'product_info/version', hash[:product_info][:version] = {},
|
8
8
|
:attribute => [:major, :minor, :build, :revision])
|
data/lib/ovirt/service.rb
CHANGED
@@ -52,7 +52,8 @@ module Ovirt
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def version
|
55
|
-
|
55
|
+
# HACK: using full_version if available due to version being wrong, https://bugzilla.redhat.com/show_bug.cgi?id=1284654
|
56
|
+
@version ||= full_version || product_info[:version]
|
56
57
|
end
|
57
58
|
|
58
59
|
def version_string
|
@@ -336,5 +337,12 @@ module Ovirt
|
|
336
337
|
end
|
337
338
|
end
|
338
339
|
end
|
340
|
+
|
341
|
+
def full_version
|
342
|
+
v = product_info[:full_version]
|
343
|
+
return if v.blank?
|
344
|
+
v = v.sub("-", ".").split(".")[0..3]
|
345
|
+
Hash[[:major, :minor, :revision, :build].zip(v)]
|
346
|
+
end
|
339
347
|
end
|
340
348
|
end
|
data/lib/ovirt/version.rb
CHANGED
data/lib/ovirt/vm.rb
CHANGED
@@ -367,8 +367,7 @@ module Ovirt
|
|
367
367
|
require 'yaml'
|
368
368
|
raw_content = YAML.load(content)
|
369
369
|
hash = ovirt_cloud_init_keys.each_with_object({}) { |k, h| h[k] = raw_content.delete(k) }
|
370
|
-
custom_script
|
371
|
-
hash[:custom_script] = custom_script unless custom_script.blank?
|
370
|
+
hash[:custom_script] = YAML.dump(raw_content).sub("---\n", "") if raw_content.present?
|
372
371
|
hash.delete_nils
|
373
372
|
end
|
374
373
|
end
|
data/spec/service_spec.rb
CHANGED
@@ -101,4 +101,16 @@ EOX
|
|
101
101
|
expect(subject).to eq("https://nobody.com:443")
|
102
102
|
end
|
103
103
|
end
|
104
|
+
|
105
|
+
context "#version" do
|
106
|
+
it "with :full_version" do
|
107
|
+
allow(service).to receive(:product_info).and_return(:full_version => "3.4.5-0.3.el6ev", :version => {:major => "3", :minor => "4", :build => "0", :revision => "0"})
|
108
|
+
expect(service.version).to eq(:major => "3", :minor => "4", :revision => "5", :build => "0")
|
109
|
+
end
|
110
|
+
|
111
|
+
it "without :full_version" do
|
112
|
+
allow(service).to receive(:product_info).and_return(:version => {:major => "3", :minor => "4", :build => "0", :revision => "0"})
|
113
|
+
expect(service.version).to eq(:major => "3", :minor => "4", :revision => "0", :build => "0")
|
114
|
+
end
|
115
|
+
end
|
104
116
|
end
|
data/spec/vm_spec.rb
CHANGED
@@ -287,26 +287,9 @@ EOX
|
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
regenerate_ssh_keys: false
|
294
|
-
root_password: some_password
|
295
|
-
fqdn: example.example.com
|
296
|
-
debug: True
|
297
|
-
EOCC
|
298
|
-
|
299
|
-
expected_data = <<-EOX.chomp
|
300
|
-
<vm>
|
301
|
-
<initialization>
|
302
|
-
<regenerate_ssh_keys>false</regenerate_ssh_keys>
|
303
|
-
<root_password>some_password</root_password>
|
304
|
-
<custom_script>fqdn: example.example.com\ndebug: true\n</custom_script>
|
305
|
-
</initialization>
|
306
|
-
</vm>
|
307
|
-
EOX
|
308
|
-
|
309
|
-
return_data = <<-EOX.chomp
|
290
|
+
context "#cloud_init= Ovirt 3.4 and newer" do
|
291
|
+
let(:return_data) do
|
292
|
+
<<-EOX.chomp
|
310
293
|
<vm href="/api/vms/128f9ffd-b82c-41e4-8c00-9742ed173bac" id="128f9ffd-b82c-41e4-8c00-9742ed173bac">
|
311
294
|
<name>bd-skeletal-clone-from-template</name>
|
312
295
|
<cpu>
|
@@ -325,9 +308,51 @@ EOX
|
|
325
308
|
</memory_policy>
|
326
309
|
</vm>
|
327
310
|
EOX
|
311
|
+
end
|
312
|
+
|
313
|
+
it "with custom_script" do
|
314
|
+
cloud_config = <<-EOCC.chomp
|
315
|
+
#cloud_config
|
316
|
+
regenerate_ssh_keys: false
|
317
|
+
root_password: some_password
|
318
|
+
fqdn: example.example.com
|
319
|
+
debug: True
|
320
|
+
EOCC
|
321
|
+
|
322
|
+
expected_data = <<-EOX.chomp
|
323
|
+
<vm>
|
324
|
+
<initialization>
|
325
|
+
<regenerate_ssh_keys>false</regenerate_ssh_keys>
|
326
|
+
<root_password>some_password</root_password>
|
327
|
+
<custom_script>fqdn: example.example.com\ndebug: true\n</custom_script>
|
328
|
+
</initialization>
|
329
|
+
</vm>
|
330
|
+
EOX
|
331
|
+
|
332
|
+
expect(service).to receive(:api).and_return(:product_info => {:version => {:major => "3", :minor => "4", :revision => "0", :build => "0"}})
|
333
|
+
expect(service).to receive(:resource_put).once.with(vm.attributes[:href], expected_data).and_return(return_data)
|
334
|
+
vm.cloud_init = cloud_config
|
335
|
+
end
|
328
336
|
|
329
|
-
|
330
|
-
|
331
|
-
|
337
|
+
it "without custom_script" do
|
338
|
+
cloud_config = <<-EOCC.chomp
|
339
|
+
#cloud_config
|
340
|
+
regenerate_ssh_keys: false
|
341
|
+
root_password: some_password
|
342
|
+
EOCC
|
343
|
+
|
344
|
+
expected_data = <<-EOX.chomp
|
345
|
+
<vm>
|
346
|
+
<initialization>
|
347
|
+
<regenerate_ssh_keys>false</regenerate_ssh_keys>
|
348
|
+
<root_password>some_password</root_password>
|
349
|
+
</initialization>
|
350
|
+
</vm>
|
351
|
+
EOX
|
352
|
+
|
353
|
+
expect(service).to receive(:api).and_return(:product_info => {:version => {:major => "3", :minor => "4", :revision => "0", :build => "0"}})
|
354
|
+
expect(service).to receive(:resource_put).once.with(vm.attributes[:href], expected_data).and_return(return_data)
|
355
|
+
vm.cloud_init = cloud_config
|
356
|
+
end
|
332
357
|
end
|
333
358
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ovirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Frey
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2015-
|
19
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: bundler
|