fixed ET find and corrected validation code
This commit is contained in:
parent
1306b1bdfe
commit
f54792e117
|
@ -70,8 +70,8 @@
|
|||
"taskReferenceName" : "extract_infrastructure_id",
|
||||
"type" : "SIMPLE",
|
||||
"inputParameters" : {
|
||||
"code" : "exec('import xml.etree.ElementTree as ET') or list(map(lambda n: n.text, ET.fromstring(data['xmlstring']).findall('Resource[Profile/SecondaryType = \"INFRASTRUCTURE\"]/ID')))",
|
||||
"xmlstring" : "${retrieve_vre.output.body}"
|
||||
"code" : "exec('import xml.etree.ElementTree as ET') or list(map(lambda n: n.text, ET.fromstring(data['xmlstring']).findall('Resource/Profile/[SecondaryType=\\'INFRASTRUCTURE\\'][Name=\\'VirtualOrganisation\\']/../ID')))",
|
||||
"xmlstring" : "${retrieve_infrastructure.output.body}"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -130,9 +130,9 @@
|
|||
"name": "LAMBDA_TASK",
|
||||
"taskReferenceName": "check",
|
||||
"inputParameters": {
|
||||
"vre": "${extract_vre_id.output.result}",
|
||||
"infra": "${extract_vre_id.output.result}",
|
||||
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))} if(e($.vre) || e($.infra)) throw('VRE ID and Infra ID must not be empty'); var tree = $.ctx.split('%2F'); return { child : tree[tree.length - 1], parent : tree[tree.length-2], decoded_root_vo : $.root_vo.replace('%2F', '/') }"
|
||||
"vre": "${extract_vre_id.output.result[0]}",
|
||||
"infra": "${extract_infrastructure_id.output.result[0]}",
|
||||
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))} if(e($.vre) || e($.infra)) throw('VRE ID and Infra ID must not be empty'); {}"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -156,7 +156,7 @@
|
|||
"name": "pyrest",
|
||||
"taskReferenceName": "write_to_is",
|
||||
"inputParameters": {
|
||||
"url": "https://en5ql62qrka7q.x.pipedream.net/${init.output.result.child}",
|
||||
"url": "https://envk9v55ynw3o.x.pipedream.net//${init.output.result.child}",
|
||||
"method": "PUT",
|
||||
"headers": {
|
||||
"Authorization": "Bearer bearer_here",
|
||||
|
@ -165,13 +165,13 @@
|
|||
},
|
||||
"body": {
|
||||
"type": "Context",
|
||||
"id": "${init.output.result.child}",
|
||||
"id": "${extract_vre_id.output.result[0]}",
|
||||
"name": "${init.output.result.child}",
|
||||
"parent": {
|
||||
"type": "IsParentOf",
|
||||
"source": {
|
||||
"type": "Context",
|
||||
"id": "${init.output.result.parent}"
|
||||
"id": "${extract_infrastructure_id.output.result[0]}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue