Merge "Add a service catalog override to the functional tests"

This commit is contained in:
Jenkins 2016-03-30 14:56:34 +00:00 committed by Gerrit Code Review
commit d89f0a3889
2 changed files with 27 additions and 1 deletions

View File

@ -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)

View File

@ -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')