Activity log for bug #1711444

Date Who What changed Old value New value Message
2017-08-17 19:44:54 Bob Haddleton bug added bug
2017-08-17 19:48:01 Bob Haddleton mistral: assignee Bob Haddleton (bob-haddleton)
2017-08-17 19:48:06 Bob Haddleton mistral: status New In Progress
2017-08-22 17:19:35 Bob Haddleton summary Nested AdHoc actions do not process all output transformations Nested AdHoc actions do not process all input defaults or output transformations
2017-08-22 17:19:35 Bob Haddleton description When using nested AdHoc Actions that use output transformations, the action result is only being transformed by the output of the action that is being called. Output transformations in nested actions are not processed. For example: actions: concat_twice: base: std.echo base-input: output: "<% $.s1 %>+<% $.s2 %>" input: - s1: "a" - s2 output: "<% $ %> and <% $ %>" nested_concat: base: my_wb.concat_twice base-input: s1: '{{ _.n1 }}' s2: 'bar' input: - n1: 'foo' output: nested_concat: '{{ _ }}' If concat_twice is called, the output is "foo+bar and foo+bar" So the expected output from nested_concat would be {"nested_concat": "foo+bar and foo+bar"} But since the output transform of the called action is the only one that is executed, the output transform in the concat_twice action is skipped and the output is: {"nested_concat": "foo+bar"} The fix for this is to do the same traversal of nested actions in the _prepare_output() method that is already being done in the _prepare_input() method, except that the order is reversed so that the base action output transform is processed first, and the called action output transform is called last. def _prepare_output(self, result): # In case of error, we don't transform a result. if not result.is_error(): for action_def in reversed(self.adhoc_action_defs): adhoc_action_spec = spec_parser.get_action_spec(action_def.spec) transformer = adhoc_action_spec.get_output() if transformer is not None: result = ml_actions.Result( data=expr.evaluate_recursively(transformer, result.data), error=result.error ) return result When using nested AdHoc Actions that use output transformations, the input defaults for the nested actions are not processed, and the action result is only being transformed by the output of the action that is being called. Output transformations in nested actions are not processed. For example: actions: concat_twice: base: std.echo base-input: output: "<% $.s1 %>+<% $.s2 %>" input: - s1: "a" - s2 output: "<% $ %> and <% $ %>" nested_concat: base: my_wb.concat_twice base-input: s2: '{{ _.n2 }}' input: - n2: 'b' output: nested_concat: '{{ _ }}' If concat_twice is called with s2='b', the output is "a+b and a+b" So the expected output from nested_concat would be {"nested_concat": "a+b and a+b"} But since the input defaults of concat_twice are not processed, and the output transform of the called action is the only one that is executed, the output transform in the concat_twice action is skipped and the output is: {"nested_concat": "+b"} The input defaults for each nested action can be processed in the existing traversal of nested action specs in _prepare_input(), instead of just processing the called action. The output transformations can be processed with the same traversal of nested actions in the _prepare_output() method that is already being done in the _prepare_input() method, except that the order is reversed so that the base action output transform is processed first, and the called action output transform is called last. def _prepare_output(self, result): # In case of error, we don't transform a result. if not result.is_error(): for action_def in reversed(self.adhoc_action_defs): adhoc_action_spec = spec_parser.get_action_spec(action_def.spec) transformer = adhoc_action_spec.get_output() if transformer is not None: result = ml_actions.Result( data=expr.evaluate_recursively(transformer, result.data), error=result.error ) return result
2017-08-29 09:42:43 Renat Akhmerov mistral: milestone pike-rc2
2017-08-29 09:42:47 Renat Akhmerov mistral: importance Undecided Medium
2017-08-29 09:42:50 Renat Akhmerov mistral: importance Medium High
2017-08-30 18:10:00 OpenStack Infra mistral: status In Progress Fix Released
2017-09-26 06:36:34 OpenStack Infra tags in-stable-pike