ovirt 0.16.0 → 0.17.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: ca8376a9e571b169ccc200f2253351d25bdf372f
4
- data.tar.gz: fb7e94f300d6b15fe516abd9863fc8ded1e48de5
3
+ metadata.gz: 01d6ff8333c35c496865bc3f6b5ccab16cab2da9
4
+ data.tar.gz: d863b9d899008e126495897c3388a5d42fa13e88
5
5
  SHA512:
6
- metadata.gz: 718d159c9f4843c3e27d0e74d36423581f963bed85fc1b46f6f3d73783544f42feca09d5eae83185f0803419b535e5073fc4afe78ea5cb26ee4fe694254398ce
7
- data.tar.gz: 145272f9111a8cbe13cfdc3888035db4bb713360395f3ae8132b243770e67ff55cb9d06cf5ca20956e9623c23071d120e91b9e21d7192e39f4b60d2dc2271d7c
6
+ metadata.gz: 28b69033c39392679b2a13598a063ff1528d0426020ddca280d6f46d661dd88e626965724f3d33752d109e1096c80460f3dd404364708ab541ba6f1fe69df5a8
7
+ data.tar.gz: '0278243c685e0794cea9c6e523e682244cc6b3d56314590346d8b7b86fbe898c9d1e65d66e0a05da3d1498937033cbfba40bb92d78e95a9f189c4c401b7648fe'
@@ -167,12 +167,13 @@ module Ovirt
167
167
  xml_to_object(klass, doc.root)
168
168
  end
169
169
 
170
- def get_resources_by_uri_path(uri_suffix, element_name = nil)
170
+ def get_resources_by_uri_path(uri_suffix, element_name = nil, xpath = nil)
171
171
  xml = resource_get(uri_suffix)
172
172
  doc = Nokogiri::XML(xml)
173
173
  element_name ||= doc.root.name
174
174
  klass = self.class.name_to_class(element_name)
175
- objects = doc.xpath("//#{element_name}")
175
+ xpath ||= "//#{element_name}"
176
+ objects = doc.xpath(xpath)
176
177
  objects.collect { |obj| xml_to_object(klass, obj) }
177
178
  end
178
179
 
@@ -1,3 +1,3 @@
1
1
  module Ovirt
2
- VERSION = "0.16.0".freeze
2
+ VERSION = "0.17.0".freeze
3
3
  end
@@ -109,38 +109,55 @@ EOC
109
109
  end
110
110
 
111
111
  context "#get_resources_by_uri_path" do
112
- it "fetches data_center" do
113
- return_message = <<-EOX.chomp
112
+ let(:return_message) do
113
+ <<-EOX.chomp
114
114
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
115
115
  <data_center href="/api/datacenters/00000001-0001-0001-0001-0000000000f1" id="00000001-0001-0001-0001-0000000000f1">
116
- <name>Default</name>
117
- <description>The default Data Center</description>
118
- <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/storagedomains" rel="storagedomains"/>
119
- <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/clusters" rel="clusters"/>
120
- <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/networks" rel="networks"/>
121
- <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/permissions" rel="permissions"/>
122
- <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/quotas" rel="quotas"/>
123
- <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/qoss" rel="qoss"/>
124
- <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/iscsibonds" rel="iscsibonds"/>
125
- <local>false</local>
126
- <storage_format>v3</storage_format>
116
+ <name>Default</name>
117
+ <description>The default Data Center</description>
118
+ <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/storagedomains" rel="storagedomains"/>
119
+ <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/clusters" rel="clusters"/>
120
+ <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/networks" rel="networks"/>
121
+ <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/permissions" rel="permissions"/>
122
+ <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/quotas" rel="quotas"/>
123
+ <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/qoss" rel="qoss"/>
124
+ <link href="/api/datacenters/00000001-0001-0001-0001-0000000000f1/iscsibonds" rel="iscsibonds"/>
125
+ <local>false</local>
126
+ <storage_format>v3</storage_format>
127
+ <version major="3" minor="6"/>
128
+ <supported_versions>
127
129
  <version major="3" minor="6"/>
128
- <supported_versions>
129
- <version major="3" minor="6"/>
130
- </supported_versions>
131
- <status>
132
- <state>up</state>
133
- </status>
134
- <mac_pool href="/api/macpools/0000000d-000d-000d-000d-00000000037a" id="0000000d-000d-000d-000d-00000000037a"/>
135
- <quota_mode>disabled</quota_mode>
130
+ </supported_versions>
131
+ <status>
132
+ <state>up</state>
133
+ </status>
134
+ <mac_pool href="/api/macpools/0000000d-000d-000d-000d-00000000037a" id="0000000d-000d-000d-000d-00000000037a"/>
135
+ <quota_mode>disabled</quota_mode>
136
136
  </data_center>
137
- EOX
137
+ EOX
138
+ end
139
+
140
+ it "fetches data_center" do
138
141
  expect(service).to receive(:resource_get).and_return(return_message)
139
142
 
140
143
  data_center = service.get_resources_by_uri_path("/api/datacenters/00000001-0001-0001-0001-0000000000f1")
141
144
  expect(data_center[0].name).to eq "Default"
142
145
  end
143
146
 
147
+ it "fetches data_center by xpath" do
148
+ expect(service).to receive(:resource_get).and_return(return_message)
149
+
150
+ data_centers = service.get_resources_by_uri_path("/api/datacenters/00000001-0001-0001-0001-0000000000f1", nil, "//data_center")
151
+ expect(data_centers[0].name).to eq "Default"
152
+ end
153
+
154
+ it "fetches no data_centers by invalid xpath" do
155
+ expect(service).to receive(:resource_get).and_return(return_message)
156
+
157
+ data_centers = service.get_resources_by_uri_path("/api/datacenters/00000001-0001-0001-0001-0000000000f1", nil, "/xyz")
158
+ expect(data_centers).to eq []
159
+ end
160
+
144
161
  it "returns 404" do
145
162
  expect(service).to receive(:resource_get).and_raise(Ovirt::MissingResourceError)
146
163
  expect { service.get_resources_by_uri_path("/api/vms/1234") }.to raise_error(Ovirt::MissingResourceError)
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.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Frey
@@ -22,10 +22,11 @@ authors:
22
22
  - Tomas Jelinek
23
23
  - Piotr Kliczewski
24
24
  - Moti Asayag
25
+ - Satoe Imaishi
25
26
  autorequire:
26
27
  bindir: bin
27
28
  cert_chain: []
28
- date: 2017-04-21 00:00:00.000000000 Z
29
+ date: 2017-05-08 00:00:00.000000000 Z
29
30
  dependencies:
30
31
  - !ruby/object:Gem::Dependency
31
32
  name: activesupport
@@ -174,6 +175,7 @@ email:
174
175
  - tjelinek@redhat.com
175
176
  - piotr.kliczewski@gmail.com
176
177
  - masayag@redhat.com
178
+ - simaishi@redhat.com
177
179
  executables: []
178
180
  extensions: []
179
181
  extra_rdoc_files: []
@@ -226,7 +228,7 @@ files:
226
228
  - spec/vm_spec.rb
227
229
  homepage: http://github.com/ManageIQ/ovirt
228
230
  licenses:
229
- - Apache
231
+ - Apache-2.0
230
232
  metadata: {}
231
233
  post_install_message:
232
234
  rdoc_options: []