ovirt 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODE2N2E3Mzk0NmQwNWI0MmViZjZjNzhiMDIyNzFkNjhlMTcyMzdjNg==
4
+ YWY4MTRkMzgxNGI4NGZiMDMxYjNjYTE2MTViMTE2ZGNmYzA5ODA5Yg==
5
5
  data.tar.gz: !binary |-
6
- Y2Q3NGQzOGFkZTM2YTU4NjE0NmY4ZDU1YjljZGMwNWI5NmVjZDJkMA==
6
+ ODBlZDRkZWVlZDE3ODAyMGU1MDg3MTIzMGQ0NTNiYTMyNDIwMmEyZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzU3MDYzYjBjNzNlYjc4YmM2MWUxMDEzOTI5ZmFjNmQyYzVkY2E5YTFiMTA2
10
- NmZkNWExOWI5ZjVmNTBmMjZmMjg2YmQxMDJlNDMzNGI0MDBmN2I2NDFlMjlj
11
- NTQ1MWNkMjgxZGVjZjg2MDQ1MDQ0YmEyZjYzYjdmNGQ1MjUyZjI=
9
+ ZjJhYmU3YTQyN2JmOTA3MDAzODQ2OGEyODE5YmQ1OGE4N2UyYzcwMTgzZjkx
10
+ NmJmNDg5ODMzZTUzYTZlOWI4MDgyMDAxZDM5MGE5YWY2OWM5NjVmMWEwNmM4
11
+ M2ZlMTc4NzlkMTUzYTBlNmEzY2ViMmQxMTAxNTQ3MGU0YjA5M2Y=
12
12
  data.tar.gz: !binary |-
13
- YWYxNDQzYjE5ODIwYjFkYjEyNWIyYzdhMzFlZGM1OGNiNjU4N2VkZjk1ZTVj
14
- NzgzZTlmYWNhZTUzYTMxNWYwMGRmNjMzNzVmOTc4M2NjYjUxOTZhZjc3OWRj
15
- OGEzN2QxYWZiYjk3Mzc0MDhmMDQ5OWQzNzA2YTkzNzk4YWNlNTE=
13
+ ZTNmNjkyOTU3MWEwMDNiZDFiNjFlYzZkZWI3ZTgyY2EzOTZjMjkyYTk1YTYx
14
+ ZTcxMmI1M2NiY2I2OGJjNzQyNzUwMmI5OTFiNWJjZjFlY2Q2MjVmYmEyNDgz
15
+ MGU0NWRmZDBiNzUyYTdmNWU3MDYwMGJlYTQ1OTFjNWY1ODc5ZmM=
data/lib/ovirt/api.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Api < Object
2
+ class Api < Base
3
3
 
4
4
  def self.parse_xml(xml)
5
5
  node, hash = xml_to_hash(xml)
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Object
2
+ class Base
3
3
  def self.create_from_xml(service, xml)
4
4
  self.new(service, parse_xml(xml))
5
5
  end
@@ -173,7 +173,7 @@ module Ovirt
173
173
 
174
174
  def self.object_to_id(object)
175
175
  case object
176
- when Ovirt::Object
176
+ when Ovirt::Base
177
177
  object = object[:id]
178
178
  when String
179
179
  raise ArgumentError, "object must be a valid guid" unless object.guid?
@@ -252,7 +252,7 @@ module Ovirt
252
252
  rel_str = 'storage_domains' if rel_str == 'storagedomains'
253
253
  rel_str = 'data_centers' if rel_str == 'datacenters'
254
254
  singular = rel_str.singularize
255
- klass = singular.camelize.constantize
255
+ klass = Ovirt.const_get(singular.camelize)
256
256
  xml = @service.resource_get(@relationships[m])
257
257
  doc = Nokogiri::XML(xml)
258
258
  return doc.root.xpath(singular).collect { |node| klass.create_from_xml(@service, node) }
data/lib/ovirt/cdrom.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Cdrom < Object
2
+ class Cdrom < Base
3
3
 
4
4
  self.top_level_objects = [:vm, :file]
5
5
 
data/lib/ovirt/cluster.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Cluster < Object
2
+ class Cluster < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description]
5
5
  self.top_level_objects = [:data_center, :scheduling_policy]
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class DataCenter < Object
2
+ class DataCenter < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description, :storage_type, :storage_format]
5
5
 
data/lib/ovirt/disk.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Disk < Object
2
+ class Disk < Base
3
3
 
4
4
  self.top_level_strings = [:name, :type, :interface, :format, :image_id]
5
5
  self.top_level_booleans = [:sparse, :bootable, :wipe_after_delete, :propagate_errors]
data/lib/ovirt/domain.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Domain < Object
2
+ class Domain < Base
3
3
 
4
4
  self.top_level_strings = [:name]
5
5
 
data/lib/ovirt/event.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Event < Object
2
+ class Event < Base
3
3
 
4
4
  self.top_level_strings = [:description, :severity]
5
5
  self.top_level_integers = [:code]
data/lib/ovirt/file.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class File < Object
2
+ class File < Base
3
3
 
4
4
  self.top_level_strings = [:name]
5
5
  self.top_level_objects = [:storage_domain]
data/lib/ovirt/group.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Group < Object
2
+ class Group < Base
3
3
 
4
4
  self.top_level_strings = [:name]
5
5
 
data/lib/ovirt/host.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Host < Object
2
+ class Host < Base
3
3
 
4
4
  self.top_level_strings = [:name, :type, :address]
5
5
  self.top_level_integers = [:port]
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class HostNic < Object
2
+ class HostNic < Base
3
3
 
4
4
  self.top_level_strings = [:name, :boot_protocol]
5
5
  self.top_level_integers = [:speed]
data/lib/ovirt/network.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Network < Object
2
+ class Network < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description]
5
5
  self.top_level_booleans = [:stp, :display]
data/lib/ovirt/nic.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Nic < Object
2
+ class Nic < Base
3
3
 
4
4
  self.top_level_strings = [:name, :interface]
5
5
  self.top_level_objects = [:vm, :network]
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Permission < Object
2
+ class Permission < Base
3
3
 
4
4
  self.top_level_objects = [:role, :user]
5
5
 
data/lib/ovirt/permit.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Permit < Object
2
+ class Permit < Base
3
3
 
4
4
  self.top_level_strings = [:name]
5
5
  self.top_level_booleans = [:administrative]
data/lib/ovirt/role.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Role < Object
2
+ class Role < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description]
5
5
  self.top_level_booleans = [:administrative, :mutable]
data/lib/ovirt/service.rb CHANGED
@@ -120,7 +120,7 @@ module Ovirt
120
120
  def status(link)
121
121
  response = resource_get(link)
122
122
 
123
- node = Object.xml_to_nokogiri(response)
123
+ node = Base.xml_to_nokogiri(response)
124
124
  node.xpath('status/state').text
125
125
  end
126
126
 
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Snapshot < Object
2
+ class Snapshot < Base
3
3
 
4
4
  self.top_level_strings = [:description, :snapshot_status, :type]
5
5
  self.top_level_timestamps = [:date]
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Statistic < Object
2
+ class Statistic < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description, :type, :unit]
5
5
 
data/lib/ovirt/storage.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Storage < Object
2
+ class Storage < Base
3
3
 
4
4
  self.top_level_objects = [:host]
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class StorageDomain < Object
2
+ class StorageDomain < Base
3
3
 
4
4
  self.top_level_strings = [:name, :type, :storage_format]
5
5
  self.top_level_booleans = [:master]
data/lib/ovirt/tag.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Tag < Object
2
+ class Tag < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description]
5
5
  self.top_level_objects = [:host, :user, :vm]
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Template < Object
2
+ class Template < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description, :type]
5
5
  self.top_level_booleans = [:stateless]
@@ -88,7 +88,7 @@ module Ovirt
88
88
  def create_vm(options = {})
89
89
  options = options.dup
90
90
  determine_clone_type(options)
91
- options[:storage] = Object.object_to_id(options[:storage]) if options[:storage]
91
+ options[:storage] = Base.object_to_id(options[:storage]) if options[:storage]
92
92
 
93
93
  case options[:clone_type]
94
94
  when :full; clone_to_vm(options)
@@ -147,7 +147,7 @@ module Ovirt
147
147
  builder = Nokogiri::XML::Builder.new do |xml|
148
148
  xml.vm do
149
149
  xml.name options[:name]
150
- xml.cluster(:id => Object.object_to_id(options[:cluster]))
150
+ xml.cluster(:id => Base.object_to_id(options[:cluster]))
151
151
  xml.template(:id => self[:id])
152
152
 
153
153
  CLONE_ATTRIBUTES_WITH_SCALARS.each do |key|
data/lib/ovirt/user.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class User < Object
2
+ class User < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description, :domain, :user_name]
5
5
  self.top_level_booleans = [:logged_in]
data/lib/ovirt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ovirt
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/ovirt/vmpool.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Ovirt
2
- class Vmpool < Object
2
+ class Vmpool < Base
3
3
 
4
4
  self.top_level_strings = [:name, :description]
5
5
  self.top_level_integers = [:size]
data/lib/ovirt.rb CHANGED
@@ -2,7 +2,7 @@ require 'active_support/all'
2
2
  require 'more_core_extensions/all'
3
3
 
4
4
  require 'ovirt/exception'
5
- require 'ovirt/object'
5
+ require 'ovirt/base'
6
6
  require 'ovirt/version'
7
7
 
8
8
  require 'ovirt/api'
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Ovirt::Object do
3
+ describe Ovirt::Base do
4
4
  it ".api_endpoint" do
5
- Ovirt::Object.api_endpoint.should == "objects"
5
+ Ovirt::Base.api_endpoint.should == "bases"
6
6
  Ovirt::Template.api_endpoint.should == "templates"
7
7
  Ovirt::Cluster.api_endpoint.should == "clusters"
8
8
  Ovirt::Vm.api_endpoint.should == "vms"
@@ -127,7 +127,7 @@ EOX
127
127
 
128
128
  context "build_clone_xml" do
129
129
  it "Properly sets vm/cpu/topology attributes" do
130
- Object.stub(:object_to_id)
130
+ Ovirt::Base.stub(:object_to_id)
131
131
  xml = @template.send(:build_clone_xml, :name => "Blank", :cluster => "6b8f1c1e-3eb0-11e4-8420-56847afe9799")
132
132
  nodeset = Nokogiri::XML.parse(xml).xpath("//vm/cpu/topology")
133
133
  node = nodeset.first
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Frey
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-26 00:00:00.000000000 Z
12
+ date: 2014-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -153,6 +153,7 @@ files:
153
153
  - README.md
154
154
  - lib/ovirt.rb
155
155
  - lib/ovirt/api.rb
156
+ - lib/ovirt/base.rb
156
157
  - lib/ovirt/cdrom.rb
157
158
  - lib/ovirt/cluster.rb
158
159
  - lib/ovirt/data_center.rb
@@ -168,7 +169,6 @@ files:
168
169
  - lib/ovirt/inventory.rb
169
170
  - lib/ovirt/network.rb
170
171
  - lib/ovirt/nic.rb
171
- - lib/ovirt/object.rb
172
172
  - lib/ovirt/permission.rb
173
173
  - lib/ovirt/permit.rb
174
174
  - lib/ovirt/role.rb
@@ -183,8 +183,8 @@ files:
183
183
  - lib/ovirt/version.rb
184
184
  - lib/ovirt/vm.rb
185
185
  - lib/ovirt/vmpool.rb
186
+ - spec/base_spec.rb
186
187
  - spec/event_spec.rb
187
- - spec/object_spec.rb
188
188
  - spec/service_spec.rb
189
189
  - spec/spec_helper.rb
190
190
  - spec/template_spec.rb
@@ -215,8 +215,8 @@ specification_version: 4
215
215
  summary: Ovirt provides a simple Object Oriented interface to the REST API of oVirt
216
216
  and RHEV-M servers.
217
217
  test_files:
218
+ - spec/base_spec.rb
218
219
  - spec/event_spec.rb
219
- - spec/object_spec.rb
220
220
  - spec/service_spec.rb
221
221
  - spec/spec_helper.rb
222
222
  - spec/template_spec.rb