ZhiQiang Fan | 39f9722 | 2013-09-20 04:49:44 +0800 | [diff] [blame] | 1 | # Copyright 2012 OpenStack Foundation |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 16 | from oslo_log import log as logging |
| 17 | |
Andrea Frittoli (andreaf) | e07579c | 2016-08-05 07:27:02 +0100 | [diff] [blame] | 18 | from tempest import clients as tempest_clients |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 19 | from tempest import config |
Andrea Frittoli (andreaf) | e07579c | 2016-08-05 07:27:02 +0100 | [diff] [blame] | 20 | from tempest.lib.services import clients |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 21 | |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 22 | CONF = config.CONF |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 23 | LOG = logging.getLogger(__name__) |
Andrea Frittoli | f9cde7e | 2014-02-18 09:57:04 +0000 | [diff] [blame] | 24 | |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 25 | |
Andrea Frittoli (andreaf) | e07579c | 2016-08-05 07:27:02 +0100 | [diff] [blame] | 26 | class Manager(clients.ServiceClients): |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 27 | """Service client manager class for backward compatibility |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 28 | |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 29 | The former manager.Manager is not a stable interface in Tempest, |
| 30 | nonetheless it is consumed by a number of plugins already. This class |
| 31 | exists to provide some grace time for the move to tempest.lib. |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 32 | """ |
| 33 | |
Andrea Frittoli (andreaf) | 3e82af7 | 2016-05-05 22:53:38 +0100 | [diff] [blame] | 34 | def __init__(self, credentials, scope='project'): |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 35 | msg = ("tempest.manager.Manager is not a stable interface and as such " |
| 36 | "it should not imported directly. It will be removed as " |
| 37 | "soon as the client manager becomes available in tempest.lib.") |
| 38 | LOG.warning(msg) |
Daniel Mellado | cad3f3d | 2016-08-19 14:17:16 +0000 | [diff] [blame] | 39 | dscv = CONF.identity.disable_ssl_certificate_validation |
Andrea Frittoli (andreaf) | e07579c | 2016-08-05 07:27:02 +0100 | [diff] [blame] | 40 | _, uri = tempest_clients.get_auth_provider_class(credentials) |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 41 | super(Manager, self).__init__( |
| 42 | credentials=credentials, scope=scope, |
| 43 | identity_uri=uri, |
| 44 | disable_ssl_certificate_validation=dscv, |
Daniel Mellado | cad3f3d | 2016-08-19 14:17:16 +0000 | [diff] [blame] | 45 | ca_certs=CONF.identity.ca_certificates_file, |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 46 | trace_requests=CONF.debug.trace_requests) |
Andrea Frittoli | 9001235 | 2015-02-25 21:58:02 +0000 | [diff] [blame] | 47 | |
| 48 | |
Andrea Frittoli (andreaf) | 3e82af7 | 2016-05-05 22:53:38 +0100 | [diff] [blame] | 49 | def get_auth_provider(credentials, pre_auth=False, scope='project'): |
Andrea Frittoli (andreaf) | 2395014 | 2016-06-13 12:39:29 +0100 | [diff] [blame] | 50 | """Shim to get_auth_provider in clients.py |
| 51 | |
| 52 | get_auth_provider used to be hosted in this module, but it has been |
| 53 | moved to clients.py now as a more permanent location. |
| 54 | This module will be removed eventually, and this shim is only |
| 55 | maintained for the benefit of plugins already consuming this interface. |
| 56 | """ |
| 57 | msg = ("tempest.manager.get_auth_provider is not a stable interface and " |
| 58 | "as such it should not imported directly. It will be removed as " |
| 59 | "the client manager becomes available in tempest.lib.") |
| 60 | LOG.warning(msg) |
ghanshyam | 9d7bac4 | 2016-08-08 13:29:25 +0900 | [diff] [blame] | 61 | return tempest_clients.get_auth_provider(credentials=credentials, |
| 62 | pre_auth=pre_auth, scope=scope) |