示例#1
0
 def test_authenticated(self):
     self.config(auth_strategy='keystone', group='json_rpc')
     self.service = server.WSGIService(FakeManager(), self.serializer)
     self.app = self.server_mock.call_args[0][2]
     self._request('success', {
         'context': self.ctx,
         'x': 42
     },
                   expected_error=401)
示例#2
0
    def setUp(self):
        super(TestService, self).setUp()
        self.config(auth_strategy='noauth', group='json_rpc')
        self.server_mock = self.useFixture(
            fixtures.MockPatch('oslo_service.wsgi.Server', autospec=True)).mock

        self.serializer = objects_base.IronicObjectSerializer(is_server=True)
        self.service = server.WSGIService(FakeManager(), self.serializer)
        self.app = self.service._application
        self.ctx = {'user_name': 'admin'}
示例#3
0
 def _setup_http_basic(self):
     with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:
         f.write('myName:$2y$05$lE3eGtyj41jZwrzS87KTqe6.'
                 'JETVCWBkc32C63UP2aYrGoYOEpbJm\n\n\n')
     self.addCleanup(os.remove, f.name)
     self.config(http_basic_auth_user_file=f.name, group='json_rpc')
     self.config(auth_strategy='http_basic', group='json_rpc')
     # self.config(http_basic_username='******', group='json_rpc')
     # self.config(http_basic_password='******', group='json_rpc')
     self.service = server.WSGIService(FakeManager(), self.serializer)
     self.app = self.server_mock.call_args[0][2]
示例#4
0
    def start(self):
        super(RPCService, self).start()
        admin_context = context.get_admin_context()

        serializer = objects_base.IronicObjectSerializer(is_server=True)
        if CONF.rpc_transport == 'json-rpc':
            self.rpcserver = json_rpc.WSGIService(self.manager, serializer)
        else:
            target = messaging.Target(topic=self.topic, server=self.host)
            endpoints = [self.manager]
            self.rpcserver = rpc.get_server(target, endpoints, serializer)
        self.rpcserver.start()

        self.handle_signal()
        self.manager.init_host(admin_context)

        LOG.info(
            'Created RPC server for service %(service)s on host '
            '%(host)s.', {
                'service': self.topic,
                'host': self.host
            })