Skip to content

NotImplemented error not being caught #60

@SystemsPurge

Description

@SystemsPurge

The villas-relay manager inherits its run_action from the Manager class (manager.py), where there is the following code:

def run_action(self, action, payload):
        if action == 'create':
            self.create(payload)
        elif action == 'delete':
            self.delete(payload)
        else:
            super().run_action(action, payload)

    def create(self, payload):
        raise NotImplementedError()

    def delete(self, payload):
        raise NotImplementedError()

On post, the component handler (/handlers/component.py) , does not block this:

@with_component
    def post(self, component):
        payload = json.loads(self.request.body)

        action = payload.get('action')
        if action is None:
            raise HTTPError(HTTPStatus.BAD_REQUEST)

        try:
            component.run_action(action, payload)
            self.write(component.status)

        except SimulationException as se:
            self.write({
                'exception': {
                    'msg': se.msg,
                    'args': se.args
                },
                **component.status
            })
            self.send_error(HTTPStatus.BAD_REQUEST)

As it only catches SimulationException. This seems to cause the villas-relay manager not to respond over amqp anymore.
Seems like the villas-relay manager is not made to be told explicitely when to create a component, and instead poles the villasrelay endpoint periodically then creates gateways, however two other NotImplemented errors do get raised in the rscad and rtlab simulator components, so maybe a proper response is a good idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions