Exemple #1
0
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'])
Exemple #2
0
        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)
Exemple #3
0
        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)
Exemple #4
0
        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)
Exemple #5
0
    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)
Exemple #6
0
    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)
Exemple #7
0
    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)
Exemple #8
0
    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)
Exemple #10
0
def unregister(name):
    try:
        db_api.delete_action_definition(name)
    except NotFoundException:
        print("Fail to remove action '%s', NOT FOUND!" % name)