Ejemplo n.º 1
0
def check_auth_plugin(job_args):
    _plugins = job_args.get('auth_plugins')
    for name, value in turbolift.auth_plugins(auth_plugins=_plugins).items():
        auth_plugin = job_args.get(name)
        if auth_plugin:
            value.pop('args', None)
            job_args.update(value)
            job_args['os_auth_url'] = value.get('os_auth_url')

            if baseutils.check_basestring(item=auth_plugin):
                job_args['os_region'] = auth_plugin % {'region': auth_plugin}

            LOG.debug('Auth Plugin Loaded: [ %s ]', name)
            return job_args
    else:
        return job_args
Ejemplo n.º 2
0
def check_auth_plugin(job_args):
    _plugins = job_args.get("auth_plugins")
    for name, value in turbolift.auth_plugins(auth_plugins=_plugins).items():
        auth_plugin = job_args.get(name)
        if auth_plugin:
            value.pop("args", None)
            job_args.update(value)
            job_args["os_auth_url"] = value.get("os_auth_url")

            if baseutils.check_basestring(item=auth_plugin):
                job_args["os_region"] = auth_plugin % {"region": auth_plugin}

            LOG.debug("Auth Plugin Loaded: [ %s ]", name)
            return job_args
    else:
        return job_args
Ejemplo n.º 3
0
def check_auth_plugin(job_args):
    _plugins = job_args.get('auth_plugins')
    for name, value in turbolift.auth_plugins(auth_plugins=_plugins).items():
        auth_plugin = job_args.get(name)
        if auth_plugin:
            value.pop('args', None)
            job_args.update(value)
            job_args['os_auth_url'] = value.get('os_auth_url')

            if baseutils.check_basestring(item=auth_plugin):
                job_args['os_region'] = auth_plugin % {
                    'region': auth_plugin
                }

            LOG.debug('Auth Plugin Loaded: [ %s ]', name)
            return job_args
    else:
        return job_args
Ejemplo n.º 4
0
    def _target_auth(self):
        self.target_args['container'] = self.job_args['target_container']
        self.target_args['os_region'] = self.job_args['target_region']

        # Set the target auth url
        target_auth_url = self.job_args.get('target_auth_url')
        if target_auth_url:
            self.target_args['os_auth_url'] = target_auth_url

        # Set the target user
        target_user = self.job_args.get('target_user')
        if target_user:
            self.target_args['os_user'] = target_user

        # Set the target password
        target_password = self.job_args.get('target_password')
        if target_password:
            self.target_args['os_password'] = target_password

        # Set the target apikey
        target_apikey = self.job_args.get('target_apikey')
        if target_apikey:
            self.target_args['os_apikey'] = target_apikey

        # Disable any active auth plugins, This is done because all information
        #  that may be needed from the plugin is already loaded.
        auth_plugin_list = turbolift.auth_plugins(
            auth_plugins=self.job_args.get('auth_plugins')
        )
        for item in auth_plugin_list.keys():
            self.target_args[item] = None

        # Authenticate to the target region
        LOG.info('Authenticating against the target')
        self.target_args.update(
            auth.authenticate(
                job_args=self.target_args
            )
        )