Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

KNIFE-181 #33

Closed
wants to merge 2 commits into from

2 participants

@mattray
Collaborator

Builds off the work in the KNIFE-182 pull request. Essentially we were using a mix of rackspace_auth_url and rackspace_api_auth_url, which isn't a thing to Fog. I updated everything to match Fog's rackspace_auth_url.

@krames
Collaborator

@mattray This looks good to me! Go ahead and merge it.

@mattray mattray closed this
@mattray
Collaborator

Merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 20 deletions.
  1. +4 −0 CHANGELOG.md
  2. +3 −3 README.rdoc
  3. +19 −17 lib/chef/knife/rackspace_base.rb
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## v0.6.4
+* KNIFE-181 correct mixed use of 'rackspace_auth_url' and 'rackspace_api_auth_url'. Only 'rackspace_auth_url' is correct.
+* KNIFE-182 default to Rackspace Open Cloud (v2)
+
## v0.6.2
* bump release to fix permission issues inside the gem
View
6 README.rdoc
@@ -33,13 +33,13 @@ 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>:
- knife[:rackspace_api_auth_url] = "lon.auth.api.rackspacecloud.com"
+ knife[:rackspace_auth_url] = "lon.auth.api.rackspacecloud.com"
This plugin also has support for specifying which region to create servers into:
View
36 lib/chef/knife/rackspace_base.rb
@@ -50,14 +50,14 @@ 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,
- :long => "--rackspace-api-auth-url URL",
+ option :rackspace_auth_url,
+ :long => "--rackspace-auth-url URL",
:description => "Your rackspace API auth url",
:default => "auth.api.rackspacecloud.com",
- :proc => Proc.new { |url| Chef::Config[:knife][:rackspace_api_auth_url] = url }
+ :proc => Proc.new { |url| Chef::Config[:knife][:rackspace_auth_url] = url }
option :rackspace_endpoint,
:long => "--rackspace-endpoint 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_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_auth_url] || config[:rackspace_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_auth_url] || config[:rackspace_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.