Example #1
0
    def _get_request_bag(self, log, scaling_group):
        """
        Builds :obj:`RequestBag` containing a bunch of useful stuff for making
        HTTP requests.
        """
        tenant_id = scaling_group.tenant_id
        dispatcher = get_legacy_dispatcher(reactor, self.authenticator, log,
                                           self.service_configs)
        lb_region = config_value('regionOverrides.cloudLoadBalancers')

        def authenticate():
            log.msg("Authenticating for tenant")
            d = self.authenticator.authenticate_tenant(tenant_id, log=log)

            def when_authenticated((auth_token, service_catalog)):
                bag = RequestBag(
                    lb_region=lb_region or self.region,
                    region=self.region,
                    dispatcher=dispatcher,
                    tenant_id=tenant_id,
                    auth_token=auth_token,
                    service_catalog=service_catalog,
                    re_auth=authenticate,
                )
                return bag

            return d.addCallback(when_authenticated)

        return authenticate()
Example #2
0
    def _get_request_bag(self, log, scaling_group):
        """
        Builds :obj:`RequestBag` containing a bunch of useful stuff for making
        HTTP requests.
        """
        tenant_id = scaling_group.tenant_id
        dispatcher = get_legacy_dispatcher(reactor, self.authenticator, log,
                                           self.service_configs)
        lb_region = config_value('regionOverrides.cloudLoadBalancers')

        def authenticate():
            log.msg("Authenticating for tenant")
            d = self.authenticator.authenticate_tenant(tenant_id, log=log)

            def when_authenticated((auth_token, service_catalog)):
                bag = RequestBag(
                    lb_region=lb_region or self.region,
                    region=self.region,
                    dispatcher=dispatcher,
                    tenant_id=tenant_id,
                    auth_token=auth_token,
                    service_catalog=service_catalog,
                    re_auth=authenticate,
                )
                return bag

            return d.addCallback(when_authenticated)

        return authenticate()
Example #3
0
def get_dispatcher(reactor, authenticator, log, service_configs, store):
    return ComposedDispatcher([
        get_legacy_dispatcher(reactor, authenticator, log, service_configs),
        get_log_dispatcher(log, {}),
        get_model_dispatcher(log, store),
        file_dispatcher(),
    ])
Example #4
0
def get_dispatcher(reactor, authenticator, log, service_configs, store):
    return ComposedDispatcher([
        get_legacy_dispatcher(reactor, authenticator, log, service_configs),
        get_model_dispatcher(log, store)
    ])
Example #5
0
 def get_dispatcher(self):
     return get_legacy_dispatcher(None, None, None, None)
Example #6
0
 def get_dispatcher(self):
     return get_legacy_dispatcher(None, None, None, None)