Image client v1 and v2 try to auth in __init__

Bug #1214774 reported by Andrea Frittoli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Low
Matthew Treinish

Bug Description

The image clients try to auth against the identity service at __init__ time.

This is inconsistent with what all other clients do.
Even if not running glance tests, even if glance is set to false in the service_available config group, the glance client will try to authenticate.

    def __init__(self, config, username, password, auth_url, tenant_name=None):
        super(ImageClientJSON, self).__init__(config, username, password,
                                              auth_url, tenant_name)
        self.service = self.config.images.catalog_type
        self.http = self._get_http()

This can be solved for instance by definiting get_http and calling that in place of self.http, or by using __getattr__ to handle the case of self.http not being defined yet.

e.g.

  def get_http(self):
      return self.http if self.http is not None else self._get_http()

or

    def __getattr__(self, name):
        if name == 'http':
            self.http = self._get_http()
            return self.http
        else:
            raise AttributeError(name)

Changed in tempest:
importance: Undecided → Low
milestone: none → havana-rc
status: New → Triaged
Revision history for this message
Andrea Frittoli (andrea-frittoli) wrote :

Still valid.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/61846

Changed in tempest:
assignee: nobody → Matthew Treinish (treinish)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/61846
Committed: https://git.openstack.org/cgit/openstack/tempest/commit/?id=406da27a771130dc210f4d12bcc69b51d07fdd43
Submitter: Jenkins
Branch: master

commit 406da27a771130dc210f4d12bcc69b51d07fdd43
Author: Matthew Treinish <email address hidden>
Date: Thu Dec 12 16:42:31 2013 +0000

    Only initialize the glance_http if service is enabled

    This commit just adds a check to see if glance is set as enabled in
    the config file before initializing the glance http client. Previously
    regardless of whether glance was enabled or not glance_http would
    auth against keystone.

    Closes-Bug: #1214774
    Change-Id: I07127c21d55d58fdb294468a0b74ce2bc54d8719

Changed in tempest:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.