def test_ok(self, pop_mock, reapply_mock): process.reapply(self.uuid) pop_mock.assert_called_once_with(self.uuid, locked=False) pop_mock.return_value.acquire_lock.assert_called_once_with( blocking=False) reapply_mock.assert_called_once_with(pop_mock.return_value)
def test_reapply_with_data(self, pop_mock, reapply_mock): process.reapply(self.uuid, data=self.data) pop_mock.assert_called_once_with(self.uuid, locked=False) pop_mock.return_value.acquire_lock.assert_called_once_with( blocking=False) reapply_mock.assert_called_once_with(pop_mock.return_value, introspection_data=self.data)
def test_ok(self, pop_mock, reapply_mock): process.reapply(self.uuid) pop_mock.assert_called_once_with(self.uuid) pop_mock.return_value.acquire_lock.assert_called_once_with( blocking=False) reapply_mock.assert_called_once_with(pop_mock.return_value, introspection_data=None)
def test_ok(self, pop_mock, reapply_mock): process.reapply(self.uuid) pop_mock.assert_called_once_with(self.uuid, locked=False) pop_mock.return_value.acquire_lock.assert_called_once_with( blocking=False ) reapply_mock.assert_called_once_with(pop_mock.return_value)
def test_reapply_with_data(self, pop_mock, reapply_mock): process.reapply(self.uuid, data=self.data) pop_mock.assert_called_once_with(self.uuid, locked=False) pop_mock.return_value.acquire_lock.assert_called_once_with( blocking=False ) reapply_mock.assert_called_once_with(pop_mock.return_value, introspection_data=self.data)
def do_reapply(self, context, node_id, token=None): try: data = process.get_introspection_data(node_id, processed=False, get_json=True) except utils.IntrospectionDataStoreDisabled: raise utils.Error(_('Inspector is not configured to store ' 'data. Set the [processing]store_data ' 'configuration option to change this.'), code=400) process.reapply(node_id, data)
def test_locking_failed(self, pop_mock, reapply_mock): pop_mock.return_value.acquire_lock.return_value = False exc = utils.Error('Node locked, please, try again later') with self.assertRaises(type(exc)) as cm: process.reapply(self.uuid) self.assertEqual(str(exc), str(cm.exception)) pop_mock.assert_called_once_with(self.uuid, locked=False) pop_mock.return_value.acquire_lock.assert_called_once_with( blocking=False)
def test_locking_failed(self, pop_mock, reapply_mock): pop_mock.return_value.acquire_lock.return_value = False exc = utils.Error('Node locked, please, try again later') with self.assertRaises(type(exc)) as cm: process.reapply(self.uuid) self.assertEqual(str(exc), str(cm.exception)) pop_mock.assert_called_once_with(self.uuid, locked=False) pop_mock.return_value.acquire_lock.assert_called_once_with( blocking=False )
def api_introspection_reapply(node_id): if flask.request.content_length: return error_response(_('User data processing is not ' 'supported yet'), code=400) if CONF.processing.store_data == 'swift': process.reapply(node_id) return '', 202 else: return error_response(_('Inspector is not configured to store' ' data. Set the [processing] ' 'store_data configuration option to ' 'change this.'), code=400)
def do_reapply(self, context, node_uuid, token=None, data=None): if not data: try: data = process.get_introspection_data(node_uuid, processed=False, get_json=True) except utils.IntrospectionDataStoreDisabled: raise utils.Error(_('Inspector is not configured to store ' 'introspection data. Set the ' '[processing]store_data configuration ' 'option to change this.')) else: process.store_introspection_data(node_uuid, data, processed=False) process.reapply(node_uuid, data=data)
def api_introspection_reapply(uuid): utils.check_auth(flask.request) if flask.request.content_length: return error_response(_('User data processing is not ' 'supported yet'), code=400) if CONF.processing.store_data == 'swift': process.reapply(uuid) return '', 202 else: return error_response(_('Inspector is not configured to store' ' data. Set the [processing] ' 'store_data configuration option to ' 'change this.'), code=400)
def do_reapply(self, context, node_uuid, token=None, data=None): if not data: try: data = process.get_introspection_data(node_uuid, processed=False, get_json=True) except utils.IntrospectionDataStoreDisabled: raise utils.Error( _('Inspector is not configured to store ' 'introspection data. Set the ' '[processing]store_data configuration ' 'option to change this.')) else: process.store_introspection_data(node_uuid, data, processed=False) process.reapply(node_uuid, data=data)
def do_reapply(self, context, node_id, token=None): process.reapply(node_id)