rbovirt 0.0.8 → 0.0.9

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.8
1
+ 0.0.9
data/lib/client/vm_api.rb CHANGED
@@ -56,6 +56,12 @@ module OVIRT
56
56
  http_delete("/vms/%s" % id)
57
57
  end
58
58
 
59
+ def set_ticket(vm_id, options={})
60
+ ticket = OVIRT::VM.ticket(options)
61
+ xml_response = http_post("/vms/%s/ticket" % vm_id, ticket)
62
+ (xml_response/'action/ticket/value').first.text
63
+ end
64
+
59
65
  def update_vm(opts)
60
66
  opts[:cluster_name] ||= clusters.first.name
61
67
  result_xml = http_put("/vms/%s" % opts[:id], OVIRT::VM.to_xml(opts))
data/lib/ovirt/vm.rb CHANGED
@@ -25,7 +25,14 @@ module OVIRT
25
25
  @volumes ||= @client.vm_volumes(id)
26
26
  end
27
27
 
28
- def self.to_xml( opts={})
28
+ def self.ticket options={}
29
+ builder = Nokogiri::XML::Builder.new do
30
+ action_{ ticket_{ expiry_(options[:expiry] || 120) } }
31
+ end
32
+ Nokogiri::XML(builder.to_xml).root.to_s
33
+ end
34
+
35
+ def self.to_xml(opts={})
29
36
  builder = Nokogiri::XML::Builder.new do
30
37
  vm{
31
38
  name_ opts[:name] || "i-#{Time.now.to_i}"
@@ -51,16 +58,14 @@ module OVIRT
51
58
  boot(:dev=> opts[:boot_dev2] || 'hd')
52
59
  }
53
60
  display_{
54
- type_(opts[:display] || 'spice')
55
- }
56
- if(opts[:user_data] && !opts[:user_data].empty?)
57
- custom_properties {
58
- custom_property({
59
- :name => "floppyinject",
60
- :value => "#{OVIRT::FILEINJECT_PATH}:#{opts[:user_data]}",
61
- :regexp => "^([^:]+):(.*)$"})
62
- }
63
- end
61
+ type_(opts[:display])
62
+ } if opts[:display]
63
+ custom_properties {
64
+ custom_property({
65
+ :name => "floppyinject",
66
+ :value => "#{opts[:fileinject_path] || OVIRT::FILEINJECT_PATH}:#{opts[:user_data]}",
67
+ :regexp => "^([^:]+):(.*)$"})
68
+ } if(opts[:user_data] && !opts[:user_data].empty?)
64
69
  }
65
70
  end
66
71
  Nokogiri::XML(builder.to_xml).root.to_s
data/rbovirt.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rbovirt}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
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-03-12}
12
+ s.date = %q{2012-03-21}
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 = [
@@ -49,6 +49,12 @@ describe "VM Life cycle" do
49
49
  @client.vm_action(@vm.id, :shutdown)
50
50
  end
51
51
 
52
+ it "test_should_set_vm_ticket" do
53
+ @client.vm_action(@vm.id, :start)
54
+ @client.set_ticket(@vm.id)
55
+ @client.vm_action(@vm.id, :shutdown)
56
+ end
57
+
52
58
  it "test_should_destroy_vm" do
53
59
  name = 'd-'+Time.now.to_i.to_s
54
60
  vm = @client.create_vm(:name => name)
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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
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-03-12 00:00:00 +02:00
18
+ date: 2012-03-21 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency