Example #1
0
    def get_params(self, context, cluster_template, cluster, **kwargs):
        osc = self.get_osc(context)

        extra_params = kwargs.pop('extra_params', {})
        extra_params['trustee_domain_id'] = osc.keystone().trustee_domain_id
        extra_params['trustee_user_id'] = cluster.trustee_user_id
        extra_params['trustee_username'] = cluster.trustee_username
        extra_params['trustee_password'] = cluster.trustee_password

        # Only pass trust ID into the template when it is needed.
        if (cluster_template.volume_driver == 'rexray'
                or cluster_template.registry_enabled):
            if CONF.trust.cluster_user_trust:
                extra_params['trust_id'] = cluster.trust_id
            else:
                missing_setting = ('trust/cluster_user_trust = True')
                msg = ('This cluster can only be created with %s in '
                       'magnum.conf')
                raise exception.ConfigInvalid(msg % missing_setting)
        else:
            extra_params['trust_id'] = ""

        extra_params['auth_url'] = context.auth_url

        return super(BaseTemplateDefinition,
                     self).get_params(context,
                                      cluster_template,
                                      cluster,
                                      extra_params=extra_params,
                                      **kwargs)
Example #2
0
    def __init__(self, app, conf, public_api_routes=[]):
        route_pattern_tpl = '%s(\.json|\.xml)?$'

        try:
            self.public_api_routes = [re.compile(route_pattern_tpl % route_tpl)
                                      for route_tpl in public_api_routes]
        except re.error as e:
            msg = _('Cannot compile public API routes: %s') % e

            LOG.error(msg)
            raise exception.ConfigInvalid(error_msg=msg)

        super(AuthTokenMiddleware, self).__init__(app, conf)
Example #3
0
    def __init__(self, app, conf, public_api_routes=None):
        if public_api_routes is None:
            public_api_routes = []
        # TODO(?): Remove .xml and ensure it doesn't result in a
        # 401 Authentication Required instead of 404 Not Found
        route_pattern_tpl = '%s(\.json|\.xml)?$'

        try:
            self.public_api_routes = [
                re.compile(route_pattern_tpl % route_tpl)
                for route_tpl in public_api_routes
            ]
        except re.error as e:
            msg = _('Cannot compile public API routes: %s') % e

            LOG.error(msg)
            raise exception.ConfigInvalid(error_msg=msg)

        super(AuthTokenMiddleware, self).__init__(app, conf)
Example #4
0
 def test_ConfigInvalid(self):
     self.assertRaises(exception.ConfigInvalid,
                       lambda: self.raise_(exception.ConfigInvalid()))