def run_module(): module_args = dict( nodes_list=dict(type='list', required=True), ) result = dict( success=False, error='' ) module = AnsibleModule( argument_spec=module_args, supports_check_mode=True ) if module.check_mode: module.exit_json(**result) try: nodes_json = nodes.convert_nodes_json_mac_to_ports( module.params['nodes_list'] ) nodes.validate_nodes(nodes_json) result['success'] = True except exception.InvalidNode as exc: result['error'] = str(exc) module.fail_json(msg='Validation Failed', **result) module.exit_json(**result)
def run(self, context): try: nodes.validate_nodes(self.nodes_json) except exception.InvalidNode as err: LOG.error("Validation of nodes failed: %s", err) return actions.Result(error=str(err)) except Exception as err: LOG.exception("Unexpected exception during node validation") return actions.Result(error=str(err))
def run(self): try: nodes.validate_nodes(self.nodes_json) except exception.InvalidNode as err: LOG.error("Validation of nodes failed: %s", err) return mistral_workflow_utils.Result(error=str(err)) except Exception as err: LOG.exception("Unexpected exception during node validation") return mistral_workflow_utils.Result(error=str(err))
def run(self, context): try: nodes.validate_nodes(self.nodes_json) except exception.InvalidNode as err: LOG.error("Validation of nodes failed: %s", err) return actions.Result(error=str(err)) except Exception as err: LOG.exception("Unexpected exception during node validation") return actions.Result(error=str(err))
def test_valid(self): nodes.validate_nodes(VALID_NODE_JSON)
def test_valid(self): nodes.validate_nodes(VALID_NODE_JSON)