def unregister_all(): actions = get_all_registered() for action in actions: try: db_api.delete_action_definition(action['name']) print("Remove action '%s' successfully." % action['name']) except NotFoundException: print("Fail to remove action '%s', NOT FOUND!" % action['name'])
def _delete_action_definition(): with db_api.transaction(): db_model = db_api.get_action_definition(identifier) if db_model.is_system: msg = "Attempt to delete a system action: %s" % identifier raise exc.DataAccessException(msg) db_api.delete_action_definition(identifier)
def _delete_action_definition(): with db_api.transaction(): db_model = db_api.get_action_definition(identifier) if db_model.is_system: msg = "Attempt to delete a system action: %s" % identifier raise exc.DataAccessException(msg) db_api.delete_action_definition(identifier)
def _delete_action_definition(): with db_api.transaction(): db_model = db_api.get_action_definition(identifier, namespace=namespace) if db_model.is_system: raise exc.DataAccessException( "Attempt to delete a system action: %s" % identifier) db_api.delete_action_definition(identifier, namespace=namespace)
def delete(self, name): """Delete the named action.""" LOG.info("Delete action [name=%s]" % name) with db_api.transaction(): db_model = db_api.get_action_definition(name) if db_model.is_system: msg = "Attempt to delete a system action: %s" % name raise exc.DataAccessException(msg) db_api.delete_action_definition(name)
def delete(self, name): """Delete the named action.""" LOG.info("Delete action [name=%s]" % name) with db_api.transaction(): db_model = db_api.get_action_definition(name) if db_model.is_system: msg = "Attempt to delete a system action: %s" % name raise exc.DataAccessException(msg) db_api.delete_action_definition(name)
def delete(self, identifier): """Delete the named action.""" acl.enforce('actions:delete', context.ctx()) LOG.info("Delete action [identifier=%s]", identifier) with db_api.transaction(): db_model = db_api.get_action_definition(identifier) if db_model.is_system: msg = "Attempt to delete a system action: %s" % identifier raise exc.DataAccessException(msg) db_api.delete_action_definition(identifier)
def delete(self, identifier): """Delete the named action.""" acl.enforce('actions:delete', context.ctx()) LOG.info("Delete action [identifier=%s]", identifier) with db_api.transaction(): db_model = db_api.get_action_definition(identifier) if db_model.is_system: msg = "Attempt to delete a system action: %s" % identifier raise exc.DataAccessException(msg) db_api.delete_action_definition(identifier)
def test_delete_action(self): # Create action. adhoc_action_service.create_actions(ACTION_LIST, namespace=NAMESPACE) action = db_api.get_action_definition('action1', namespace=NAMESPACE) self.assertEqual(NAMESPACE, action.get('namespace')) self.assertEqual('action1', action.get('name')) # Delete action. db_api.delete_action_definition('action1', namespace=NAMESPACE) self.assertRaises(DBEntityNotFoundError, db_api.get_action_definition, name='action1', namespace=NAMESPACE)
def unregister(name): try: db_api.delete_action_definition(name) except NotFoundException: print("Fail to remove action '%s', NOT FOUND!" % name)