deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject git commit: Openstack: Capture missing username as 401 error (DTACLOUD-330)
Date Mon, 01 Oct 2012 08:52:05 GMT
Updated Branches:
  refs/heads/master d5aa10ed6 -> caf973290


Openstack: Capture missing username as 401 error (DTACLOUD-330)

Signed-off-by: Michal fojtik <mfojtik@redhat.com>


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/caf97329
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/caf97329
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/caf97329

Branch: refs/heads/master
Commit: caf973290b9c9e585fda92ebd800f8c8f8cbf2d1
Parents: d5aa10e
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Sep 27 14:15:39 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Mon Oct 1 10:52:37 2012 +0200

----------------------------------------------------------------------
 .../drivers/openstack/openstack_driver.rb          |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/caf97329/server/lib/deltacloud/drivers/openstack/openstack_driver.rb
----------------------------------------------------------------------
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


Mime
View raw message