diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-03-30 14:56:34 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-03-30 14:56:34 +0000 |
commit | d89f0a3889a8d258b2d3d73c6ed202f6fc9cafc3 (patch) | |
tree | 37f55a5d996b2aa2d9a69479c328dba6b2f0c8ea /designateclient | |
parent | fe5397031f42a9660637ea3dd6d0b7a44998aaea (diff) | |
parent | 38e9fa850589c336a0907ee0e7f26c56cd60b82e (diff) | |
download | python-designateclient-d89f0a3889a8d258b2d3d73c6ed202f6fc9cafc3.tar.gz |
Merge "Add a service catalog override to the functional tests"
Diffstat (limited to 'designateclient')
-rw-r--r-- | designateclient/functionaltests/client.py | 23 | ||||
-rw-r--r-- | designateclient/functionaltests/config.py | 5 |
2 files changed, 27 insertions, 1 deletions
diff --git a/designateclient/functionaltests/client.py b/designateclient/functionaltests/client.py index 370d48f..0bac078 100644 --- a/designateclient/functionaltests/client.py +++ b/designateclient/functionaltests/client.py @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. """ import logging +import os from tempest_lib.cli import base @@ -295,6 +296,10 @@ class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands, resp = FieldValueModel(self.keystone('token-get')) self.project_id = resp.tenant_id + @property + def using_auth_override(self): + return bool(cfg.CONF.identity.override_endpoint) + @classmethod def get_clients(cls): if not cls._CLIENTS: @@ -335,8 +340,24 @@ class DesignateCLI(base.CLIClient, ZoneCommands, ZoneTransferCommands, raise Exception("User '{0}' does not exist".format(user)) def parsed_cmd(self, cmd, model=None, *args, **kwargs): - out = self.openstack(cmd, *args, **kwargs) + if self.using_auth_override: + # use --os-url and --os-token + func = self._openstack_noauth + else: + # use --os-username --os-tenant-name --os-password --os-auth-url + func = self.openstack + + out = func(cmd, *args, **kwargs) LOG.debug(out) if model is not None: return model(out) return out + + def _openstack_noauth(self, cmd, *args, **kwargs): + exe = os.path.join(cfg.CONF.designateclient.directory, 'openstack') + options = build_option_string({ + '--os-url': cfg.CONF.identity.override_endpoint, + '--os-token': cfg.CONF.identity.override_token, + }) + cmd = options + " " + cmd + return base.execute(exe, cmd, *args, **kwargs) diff --git a/designateclient/functionaltests/config.py b/designateclient/functionaltests/config.py index edf65d4..553f25c 100644 --- a/designateclient/functionaltests/config.py +++ b/designateclient/functionaltests/config.py @@ -46,6 +46,11 @@ cfg.CONF.register_opts([ cfg.StrOpt('admin_tenant_name'), cfg.StrOpt('admin_password', secret=True), cfg.StrOpt('admin_domain_name'), + + cfg.StrOpt("override_endpoint", + help="use this url instead of the url in the service catalog"), + cfg.StrOpt("override_token", + help="with the override endpoint, pass this token to the api"), ], group='identity') |