diff --git a/designateclient/functionaltests/client.py b/designateclient/functionaltests/client.py index 39dc970c..56fa72a3 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 @@ -269,6 +270,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: @@ -309,8 +314,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 edf65d4f..553f25c3 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')