rbovirt 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rbovirt might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -8,5 +8,9 @@ module OVIRT
8
8
  @client = client
9
9
  self
10
10
  end
11
+
12
+ def parse_version xml
13
+ (xml/'version').first[:major] +"."+ (xml/'version').first[:minor]
14
+ end
11
15
  end
12
16
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  module OVIRT
3
3
  class DataCenter < BaseObject
4
- attr_reader :description, :status
4
+ attr_reader :description, :status, :storage_type, :storage_format, :supported_versions, :version
5
5
 
6
6
  def initialize(client, xml)
7
7
  super(client, xml[:id], xml[:href], (xml/'name').first.text)
@@ -12,8 +12,14 @@ module OVIRT
12
12
  private
13
13
 
14
14
  def parse_xml_attributes!(xml)
15
- @description = ((xml/'description').first.text rescue nil)
16
- @status = (xml/'status').first.text
15
+ @description = (xml/'description').first.text rescue nil
16
+ @status = (xml/'status').first.text.strip
17
+ @storage_type = (xml/'storage_type').first.text
18
+ @storage_format = (xml/'storage_format').first.text
19
+ @supported_versions = (xml/'supported_versions').collect { |v|
20
+ parse_version v
21
+ }
22
+ @version = parse_version xml rescue nil
17
23
  end
18
24
  end
19
25
 
@@ -97,7 +97,7 @@ module OVIRT
97
97
 
98
98
  def templates(opts={})
99
99
  search= opts[:search] || ("datacenter=$s" % current_datacenter.name)
100
- http_get("/templates?serach=%s" % search).xpath('/templates/template').collect do |t|
100
+ http_get("/templates?search=%s" % CGI.escape(search)).xpath('/templates/template').collect do |t|
101
101
  OVIRT::Template::new(self, t)
102
102
  end.compact
103
103
  end
@@ -108,7 +108,8 @@ module OVIRT
108
108
  end
109
109
 
110
110
  def datacenters(opts={})
111
- datacenters = http_get("/datacenters")
111
+ search = opts[:search] ||""
112
+ datacenters = http_get("/datacenters?search=%s" % CGI.escape(search))
112
113
  datacenters.xpath('/data_centers/data_center').collect do |dc|
113
114
  OVIRT::DataCenter::new(self, dc)
114
115
  end
@@ -117,7 +118,7 @@ module OVIRT
117
118
  def clusters(opts={})
118
119
  headers = {:accept => "application/xml; detail=datacenters"}
119
120
  search= opts[:search] || ("datacenter=$s" % current_datacenter.name)
120
- http_get("/clusters?serach=%s" % search, headers).xpath('/clusters/cluster').collect do |cl|
121
+ http_get("/clusters?search=%s" % CGI.escape(search), headers).xpath('/clusters/cluster').collect do |cl|
121
122
  OVIRT::Cluster.new(self, cl)
122
123
  end
123
124
  end
@@ -148,7 +149,7 @@ module OVIRT
148
149
 
149
150
  def hosts(opts={})
150
151
  search= opts[:search] || ("datacenter=$s" % current_datacenter.name)
151
- http_get("/hosts?search=%s" % search).xpath('/hosts/host').collect do |h|
152
+ http_get("/hosts?search=%s" % CGI.escape(search)).xpath('/hosts/host').collect do |h|
152
153
  OVIRT::Host::new(self, h)
153
154
  end
154
155
  end
@@ -160,7 +161,7 @@ module OVIRT
160
161
 
161
162
  def storagedomains(opts={})
162
163
  search= opts[:search] ||''
163
- http_get("/storagedomains?search=%s" % search).xpath('/storage_domains/storage_domain').collect do |sd|
164
+ http_get("/storagedomains?search=%s" % CGI.escape(search)).xpath('/storage_domains/storage_domain').collect do |sd|
164
165
  OVIRT::StorageDomain::new(self, sd)
165
166
  end
166
167
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rbovirt}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Amos Benari"]
12
- s.date = %q{2012-01-15}
12
+ s.date = %q{2012-01-16}
13
13
  s.description = %q{A Ruby client for oVirt REST API}
14
14
  s.email = %q{abenari@redhat.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbovirt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Amos Benari
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-15 00:00:00 +02:00
18
+ date: 2012-01-16 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency