Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BEE6DDC51 for ; Mon, 1 Oct 2012 08:49:10 +0000 (UTC) Received: (qmail 39832 invoked by uid 500); 1 Oct 2012 08:49:10 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 39812 invoked by uid 500); 1 Oct 2012 08:49:09 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 39792 invoked by uid 99); 1 Oct 2012 08:49:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 08:49:09 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jprovazn@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 08:49:02 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q918meV7007333 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Oct 2012 04:48:40 -0400 Received: from localhost.localdomain (unused-4-226.brq.redhat.com [10.34.4.226]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q918mciY017723 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 1 Oct 2012 04:48:39 -0400 Message-ID: <506958E5.40509@redhat.com> Date: Mon, 01 Oct 2012 10:48:37 +0200 From: Jan Provaznik User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0 MIME-Version: 1.0 To: dev@deltacloud.apache.org CC: mfojtik@redhat.com Subject: Re: [PATCH core] Openstack: Capture missing username as 401 error (DTACLOUD-330) References: <1348748139-57117-1-git-send-email-mfojtik@redhat.com> In-Reply-To: <1348748139-57117-1-git-send-email-mfojtik@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 On 09/27/2012 02:15 PM, mfojtik@redhat.com wrote: > From: Michal Fojtik > > > Signed-off-by: Michal fojtik > --- > 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