softlayer / softlayer-ruby

http://softlayer.github.io/softlayer-ruby/
MIT License
54 stars 35 forks source link

capture_image for VirtualServer does not work #47

Closed huskercane closed 10 years ago

huskercane commented 10 years ago

Here is the sample code that I am using

!/usr/bin/env ruby

require 'softlayer_api' require 'pp'

softlayer_client = SoftLayer::Client.new()

server = SoftLayer::VirtualServer.server_with_id('5508708', client: softlayer_client)

puts server.inspect

server.capture_image('master_image', true, 'master_image_note')

Here is the output that I see home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:202:in conv2value': Wrong type NilClass. Not allowed! (RuntimeError) from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:118:inblock in methodCall' from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:117:in collect' from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/create.rb:117:inmethodCall' from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/client.rb:285:in call2' from /home/rohits/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/xmlrpc/client.rb:267:incall' from /home/rohits/.rvm/gems/ruby-2.1.1/gems/softlayer_api-2.1.1/lib/softlayer/Service.rb:278:in call_softlayer_api_with_params' from /home/rohits/.rvm/gems/ruby-2.1.1/gems/softlayer_api-2.1.1/lib/softlayer/APIParameterFilter.rb:201:inmethod_missing' from /home/rohits/.rvm/gems/ruby-2.1.1/gems/softlayer_api-2.1.1/lib/softlayer/VirtualServer.rb:153:in capture_image' from ./create_image2.rb:12:in

'

It does work if I do this

require 'softlayer_api' require 'pp'

softlayer_client = SoftLayer::Client.new()

virtual_guest_service = SoftLayer::Service.new("SoftLayer_Virtual_Guest")

CAUTION - hardcoding server id here

server = virtual_guest_service.object_with_id("5508708") block_devices = server.getBlockDevices

puts server.inspect

img1 = server.createArchiveTransaction("master-image", [{"id" => block_devices[0]['id']}], "master-image") puts img1.inspect

SLsthompson commented 10 years ago

Thank you. I will see what I can do with this. If possible, I will include a fix in the 2.2.0 release which is (currently) scheduled for Monday.

SLsthompson commented 10 years ago

If you have the chance, could you please check the 2.2.0 branch:

https://github.com/softlayer/softlayer-ruby/tree/Version_2.2.0

and see if that fixes the issue for you?

huskercane commented 10 years ago

Upgraded and tried today, works great. thank you