knife, rackspace, & fog
Date: March 21, 2013
so after some initial struggling with the wonderful fog and specific versions of it to get chef rackspace tools working properly, i hit another bit of weirdness:
% knife rackspace server create -f6 -I -r 'role[base]' -E <env> -S -N -VV --rackspace-version v2
DEBUG: version v2
DEBUG: version v2
DEBUG: rackspace_api_key xxxxxxxxxxxxxxxxxxxx
DEBUG: rackspace_username
DEBUG: rackspace_api_username xxxxxxxxxxxxxxxxxxx
DEBUG: rackspace_auth_url
DEBUG: rackspace_auth_url auth.api.rackspacecloud.com
DEBUG: rackspace_endpoint
DEBUG: rackspace_endpoint https://dfw.servers.api.rackspacecloud.com/v2
Instance ID: xxxxxxxxxxxxxxxxxxxx
Name: Flavor: 8GB Standard InstanceImage:
Metadata: []
Waiting server................................................................................................................................................................................................................................
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/wait_for.rb:10:in `wait_for': The specified wait_for timeout (600 seconds) was exceeded (Fog::Errors::TimeoutError)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/model.rb:65:in `wait_for'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/knife-rackspace-0.6.2/lib/chef/knife/rackspace_server_create.rb:183:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife.rb:460:in `run_with_pretty_exceptions'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife.rb:173:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/knife.rb:123:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/knife:25:in `'
from /opt/chef/bin/knife:23:in `load'
from /opt/chef/bin/knife:23:in `'
hmmh. 600 second timeout. the rackspace api is slow creating a > 8gb v2 box.
here is a temp fix:
edit the fog core timeout.rb file to make up for this:
% vi /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/timeout.rb
and replace @timeout = 600
with a more sane number.
i used 1500 to be on the safe side :
@timeout = 1500
again, this is a temp fix. YMMV
Not sure if this is a new parameter since you last looked at this, but there is –server-create-timeout that can be used with knife-rackspace gem. Also, you can add the following to your knife.rb:
knife[:server_create_timeout] = 1500
when i was initially working on it i could not find that flag, but its great to know that its there now.
You can also update the timeout.rb file. Listed below is the contents of the file and location. Change @timeout = 1500
/Library/Ruby/Gems/1.8/gems/fog-1.11.1/lib/fog/core
>$ cat timeout.rb
module Fog
@timeout = 600
def self.timeout
@timeout
end
def self.timeout=(timeout)
raise ArgumentError, “timeout must be non-negative” unless timeout >= 0
@timeout = timeout
end
end
sweet!