On 15/02/11 22:33, Michal Fojtik wrote:
On Feb 15, 2011, at 9:16 PM, [email protected] wrote:
Hi,
runoninstance gave me a 'execution expired error'
[marios@marios deltacloud]$ curl -F 'cmd=uname -a' -F 'password=bla' --user
'foo:bar' http://localhost:3001/api/instances/615657/run?format=xml
<error status='500' url='/api/instances/615657/run?format=xml'>
<kind>backend_error</kind>
<backend driver='rackspace'>
<code>500</code>
<cause>Deltacloud::Runner::InstanceSSHError</cause>
<details><![CDATA[././lib/deltacloud/runner.rb:88:in `execute'
././lib/deltacloud/runner.rb:49:in `execute'
././lib/deltacloud/drivers/rackspace/rackspace_driver.rb:122:in
`run_on_instance'
././lib/deltacloud/drivers/rackspace/rackspace_driver.rb:389:in `call'
...
</backend>
<message><![CDATA[Timeout::Error: execution expired]]></message>
Your instance needs to be in RUNNING state in order to execute some commands on
it.
This error usually happens if instance is not in RUNNING state or SSH is not
started.
Can you please try it again?
ok, will do. you probably missed the second issue i ran into cos it was
at the bottom of my post - same problem as in my original review with
opts[:hwp_id] being nil
Btw. testing code I'm used:
require 'deltacloud'
c = DeltaCloud::new('rackspace_user', 'api_key', 'http://localhost:3001/api')
instance = c.instance('123456')
puts instance.run('ls -lah /', :username => 'root', :password => 'password')
-- Michal
On 15/02/11 13:40, [email protected] wrote:
From: Michal Fojtik<[email protected]>
@@ -85,25 +85,41 @@ class RackspaceDriver< Deltacloud::BaseDriver
safely do
server = rs.create_server(:name => opts[:name] || Time.now.to_s,
:imageId => image_id.to_i,
- :flavorId => opts[:hwp_id].to_i ||
hardware_profiles(credentials).first.id.to_i)
+ :flavorId => opts[:hwp_id].length>0 ?
opts[:hwp_id].to_i : 1)
result = convert_instance_after_create(server, credentials.user,
server.adminPass)
end
result
end
getting an error here. (you are still not catching the case where opts[:hwp_id]
is nil):
[marios@marios deltacloud]$ curl -i -d 'image_id=4' --user 'foo:bar'
http://localhost:3001/api/instances?format=xml
HTTP/1.1 500 Internal Server Error
X-Runtime: 4.845465
Content-Type: application/xml;charset=utf-8
Content-Length: 4739
Connection: keep-alive
Server: thin 1.2.7 codename No Hup
<error status='500' url='/api/instances?format=xml'>
<kind>backend_error</kind>
<backend driver='rackspace'>
<code>500</code>
<cause>NoMethodError</cause>
<details><![CDATA[././lib/deltacloud/drivers/rackspace/rackspace_driver.rb:88:in
`create_instance'
././lib/deltacloud/drivers/rackspace/rackspace_driver.rb:389:in `call'
././lib/deltacloud/drivers/rackspace/rackspace_driver.rb:389:in `safely'
././lib/deltacloud/drivers/rackspace/rackspace_driver.rb:85:in
`create_instance'
././server.rb:333
...
</backend>
<message><![CDATA[undefined method `length' for nil:NilClass]]></message>
Michal Fojtik
Software Engineer, Deltacloud API project
http://www.deltacloud.org
[email protected]