ovirt 0.9.1 → 0.10.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: 8a4051c95159d0bc312585f15ae16edfd3d3f26a
4
- data.tar.gz: 7971706d61da324cb250c94775443a5b90596160
3
+ metadata.gz: 1886f330149d0994b6de59583f62471a5efeed5e
4
+ data.tar.gz: dd5ed8130d545bc6a33219e007f80f2bee9cf428
5
5
  SHA512:
6
- metadata.gz: 3c09bb4f578de09a2f78a1f8ce8c9a2e1200ac33d46682a45c7af211e6fce1a1e7a6d40c28316d9aacd6474a621fe677d20d23d8cd1d17e5db166d03aaf52228
7
- data.tar.gz: f5d1f24be0de5cd39e4d65c041d886ebe8e53cf97e6d558635be95ece35133b752df1b2801f71316a0f202633baf1cbf014befb19be1fd4aaf9afeb2f7729960
6
+ metadata.gz: dd28d604f2b102b336fe528a3c6f41a3f2225b7c7eb9308554021b21f726871b486e7b34d0b83e7743823bdff278b326890612faed50abea4f556e999b94059c
7
+ data.tar.gz: 562e1d21bc674e8b57abdfde3f8aaa509da282e2dffc4707b3f7ad18be98541765c17e12685e8bead0b9ef1173dba386c47d174376f6bcc16918a37e44c23010
@@ -87,6 +87,10 @@ module Ovirt
87
87
  @service.get_resource_by_ems_ref(uri_suffix, element_name)
88
88
  end
89
89
 
90
+ def get_resources_by_uri_path(uri_suffix, element_name = nil)
91
+ @service.get_resources_by_uri_path(uri_suffix, element_name)
92
+ end
93
+
90
94
  def refresh
91
95
  # TODO: Change to not return native objects to the caller. The caller
92
96
  # should just expect raw data.
@@ -157,7 +161,7 @@ module Ovirt
157
161
 
158
162
  def collect_primary_targeted_jobs(jobs)
159
163
  results = collect_in_parallel(jobs) do |key, ems_ref|
160
- get_resource_by_ems_ref(ems_ref, key.to_s)
164
+ get_resources_by_uri_path(ems_ref, key.to_s)
161
165
  end
162
166
 
163
167
  jobs.zip(results).each_with_object({}) do |((key, _), result), hash|
data/lib/ovirt/service.rb CHANGED
@@ -126,6 +126,14 @@ module Ovirt
126
126
  end
127
127
 
128
128
  def get_resource_by_ems_ref(uri_suffix, element_name = nil)
129
+ xml = resource_get(uri_suffix)
130
+ doc = Nokogiri::XML(xml)
131
+ element_name ||= doc.root.name
132
+ klass = self.class.name_to_class(element_name)
133
+ xml_to_object(klass, doc.root)
134
+ end
135
+
136
+ def get_resources_by_uri_path(uri_suffix, element_name = nil)
129
137
  xml = resource_get(uri_suffix)
130
138
  doc = Nokogiri::XML(xml)
131
139
  element_name ||= doc.root.name
data/lib/ovirt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ovirt
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10.0"
3
3
  end
data/spec/service_spec.rb CHANGED
@@ -108,7 +108,7 @@ EOC
108
108
  expect { service.resource_get('api') }.to raise_error(Exception, "BLAH")
109
109
  end
110
110
 
111
- context "#get_resource_by_ems_ref" do
111
+ context "#get_resources_by_uri_path" do
112
112
  it "fetches data_center" do
113
113
  return_message = <<-EOX.chomp
114
114
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
@@ -137,13 +137,13 @@ EOC
137
137
  EOX
138
138
  expect(service).to receive(:resource_get).and_return(return_message)
139
139
 
140
- data_center = service.get_resource_by_ems_ref("/api/datacenters/00000001-0001-0001-0001-0000000000f1")
140
+ data_center = service.get_resources_by_uri_path("/api/datacenters/00000001-0001-0001-0001-0000000000f1")
141
141
  expect(data_center[0].name).to eq "Default"
142
142
  end
143
143
 
144
144
  it "returns 404" do
145
145
  expect(service).to receive(:resource_get).and_raise(Ovirt::MissingResourceError)
146
- expect { service.get_resource_by_ems_ref("/api/vms/1234") }.to raise_error(Ovirt::MissingResourceError)
146
+ expect { service.get_resources_by_uri_path("/api/vms/1234") }.to raise_error(Ovirt::MissingResourceError)
147
147
  end
148
148
  end
149
149
 
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.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Frey
@@ -20,7 +20,7 @@ authors:
20
20
  autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
- date: 2016-04-28 00:00:00.000000000 Z
23
+ date: 2016-05-04 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler