You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Jan Provaznik <jp...@redhat.com> on 2012/10/01 10:48:37 UTC
Re: [PATCH core] Openstack: Capture missing username as 401 error
(DTACLOUD-330)
On 09/27/2012 02:15 PM, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
>
>
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
> server/lib/deltacloud/drivers/openstack/openstack_driver.rb | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
> index 7e11258..86d6983 100644
> --- a/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
> +++ b/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
> @@ -344,6 +344,9 @@ private
> #for v2 authentication credentials.name == "username+tenant_name"
> def new_client(credentials, type = :compute)
> tokens = credentials.user.split("+")
> + if credentials.user.empty?
> + raise AuthenticationFailure.new(Exception.new("Error: you must supply the username"))
> + end
> if (tokens.size != 2 && api_v2)
> raise ValidationFailure.new(Exception.new("Error: expected \"username+tenantname\" as username, you provided: #{credentials.user}"))
> else
> @@ -505,6 +508,10 @@ private
> status 400
> end
>
> + on /Must supply a :username/ do
> + status 401
> + end
> +
> on /OpenStack::Exception::Authentication/ do
> status 401
> end
>
ACK