deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] Openstack: Capture missing username as 401 error (DTACLOUD-330)
Date Thu, 27 Sep 2012 12:15:39 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@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
-- 
1.7.12


Mime
View raw message