Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

KNIFE-182 #32

Merged
merged 1 commit into from

2 participants

Matt Ray Kyle Rames
Matt Ray
Collaborator

default to 'v2' API, updated logging to show priority

Kyle Rames
Collaborator

I was able to successfully test this change using on both the CLI and knife.rb configuration file.

Go ahead and merge it!

Matt Ray mattray merged commit b01d638 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 26, 2012
  1. Matt Ray
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 16 deletions.
  1. +3 −0  CHANGELOG.md
  2. +2 −2 README.rdoc
  3. +16 −14 lib/chef/knife/rackspace_base.rb
3  CHANGELOG.md
View
@@ -1,3 +1,6 @@
+## v0.6.4
+* KNIFE-182 default to Rackspace Open Cloud (v2)
+
## v0.6.2
* bump release to fix permission issues inside the gem
4 README.rdoc
View
@@ -33,9 +33,9 @@ You also have the option of passing your Rackspace API Username/Key into the ind
# provision a new 1GB Ubuntu 10.04 webserver
knife rackspace server create -I 112 -f 3 -A 'Your Rackspace API username' -K "Your Rackspace API Key" -r 'role[webserver]'
-To select for the new OpenStack-based "Rackspace Open Cloud" API (aka 'v2'), you can use the <tt>--rackspace-version v2</tt> command option. 'v1' is still the default, so if you're using exclusively 'v2' you will probably want to add the following to your <tt>knife.rb</tt>:
+To select for the previous Rackspace API (aka 'v1'), you can use the <tt>--rackspace-version v1</tt> command option. 'v2' is the default, so if you're still using exclusively 'v1' you will probably want to add the following to your <tt>knife.rb</tt>:
- knife[:rackspace_version] = 'v2'
+ knife[:rackspace_version] = 'v1'
This plugin also has support for authenticating against an alternate API Auth URL. This is useful if you are a Rackspace Cloud UK user, here is an example of configuring your <tt>knife.rb</tt>:
30 lib/chef/knife/rackspace_base.rb
View
@@ -50,7 +50,7 @@ def self.included(includer)
option :rackspace_version,
:long => '--rackspace-version VERSION',
:description => 'Rackspace Cloud Servers API version',
- :default => "v1",
+ :default => "v2",
:proc => Proc.new { |version| Chef::Config[:knife][:rackspace_version] = version }
option :rackspace_api_auth_url,
@@ -68,34 +68,36 @@ def self.included(includer)
end
def connection
- Chef::Log.debug("version #{Chef::Config[:knife][:rackspace_version]}") #config file
- Chef::Log.debug("version #{config[:rackspace_version]}") #cli
+ Chef::Log.debug("version #{Chef::Config[:knife][:rackspace_version]} (config)")
+ Chef::Log.debug("version #{config[:rackspace_version]} (cli)")
Chef::Log.debug("rackspace_api_key #{Chef::Config[:knife][:rackspace_api_key]}")
Chef::Log.debug("rackspace_username #{Chef::Config[:knife][:rackspace_username]}")
Chef::Log.debug("rackspace_api_username #{Chef::Config[:knife][:rackspace_api_username]}")
- Chef::Log.debug("rackspace_auth_url #{Chef::Config[:knife][:rackspace_auth_url]}")
- Chef::Log.debug("rackspace_auth_url #{config[:rackspace_api_auth_url]}")
- Chef::Log.debug("rackspace_endpoint #{Chef::Config[:knife][:rackspace_endpoint]}")
- Chef::Log.debug("rackspace_endpoint #{config[:rackspace_endpoint]}")
- if (Chef::Config[:knife][:rackspace_version] == 'v2') || (config[:rackspace_version] == 'v2')
+ Chef::Log.debug("rackspace_auth_url #{Chef::Config[:knife][:rackspace_auth_url]} (config)")
+ Chef::Log.debug("rackspace_auth_url #{config[:rackspace_api_auth_url]} (cli)")
+ Chef::Log.debug("rackspace_endpoint #{Chef::Config[:knife][:rackspace_endpoint]} (config)")
+ Chef::Log.debug("rackspace_endpoint #{config[:rackspace_endpoint]} (cli)")
+ if (Chef::Config[:knife][:rackspace_version] == 'v1') || (config[:rackspace_version] == 'v1')
+ Chef::Log.debug("rackspace v1")
@connection ||= begin
connection = Fog::Compute.new(
:provider => 'Rackspace',
- :version => 'v2',
+ :version => 'v1',
:rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
:rackspace_username => (Chef::Config[:knife][:rackspace_username] || Chef::Config[:knife][:rackspace_api_username]),
- :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url],
- :rackspace_endpoint => Chef::Config[:knife][:rackspace_endpoint] || config[:rackspace_endpoint]
+ :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
)
end
else
+ Chef::Log.debug("rackspace v2")
@connection ||= begin
connection = Fog::Compute.new(
:provider => 'Rackspace',
- :version => 'v1',
+ :version => 'v2',
:rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
:rackspace_username => (Chef::Config[:knife][:rackspace_username] || Chef::Config[:knife][:rackspace_api_username]),
- :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
+ :rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url],
+ :rackspace_endpoint => Chef::Config[:knife][:rackspace_endpoint] || config[:rackspace_endpoint]
)
end
end
@@ -145,7 +147,7 @@ def version_one?
end
def rackspace_api_version
- version = Chef::Config[:knife][:rackspace_version] || 'v1'
+ version = Chef::Config[:knife][:rackspace_version] || 'v2'
version.downcase
end
Something went wrong with that request. Please try again.