From 9d4e01e2df83a108c2c44cc4471666b5cecf4c36 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 23 Apr 2018 13:27:22 +0300 Subject: Change: all actions must have a "where" --- ick2/pipelineapi.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ick2/pipelineapi.py') diff --git a/ick2/pipelineapi.py b/ick2/pipelineapi.py index 22db2b8..da774d4 100644 --- a/ick2/pipelineapi.py +++ b/ick2/pipelineapi.py @@ -23,3 +23,21 @@ class PipelineAPI(ick2.ResourceApiBase): def get_resource_name(self, resource): return resource.get('pipeline') + + def create(self, body, **kwargs): + resource = self.mangle_new_resource(body) + + actions = resource.get('actions', []) + for action in actions: + where = action.get('where') + if where is None: + raise NoWhere(action) + + return super().create(body, **kwargs) + + +class NoWhere(Exception): + + def __init__(self, action): + super().__init__( + 'Every action MUST specify a "where": {}'.format(action)) -- cgit v1.2.1