Merge "per_node is not parsing generated json" into stable/victoria
This commit is contained in:
commit
bf71a052d3
|
@ -45,18 +45,26 @@ resources:
|
||||||
# the data of the NodeDataLookup parameter that matches the
|
# the data of the NodeDataLookup parameter that matches the
|
||||||
# system UUID
|
# system UUID
|
||||||
echo $node_lookup | $(get_python) -c "
|
echo $node_lookup | $(get_python) -c "
|
||||||
|
import ast
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
input = sys.stdin.readline() or '{}'
|
input = sys.stdin.readline() or '{}'
|
||||||
|
try:
|
||||||
cnt = json.loads(input)
|
cnt = json.loads(input)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
cnt = ast.literal_eval(input)
|
||||||
print(json.dumps(cnt.get('${node_id}', {})))
|
print(json.dumps(cnt.get('${node_id}', {})))
|
||||||
" > /etc/puppet/hieradata/${node_id}.json
|
" > /etc/puppet/hieradata/${node_id}.json
|
||||||
# handle upper case node id LP#1816652
|
# handle upper case node id LP#1816652
|
||||||
echo $node_lookup | $(get_python) -c "
|
echo $node_lookup | $(get_python) -c "
|
||||||
|
import ast
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
input = sys.stdin.readline() or '{}'
|
input = sys.stdin.readline() or '{}'
|
||||||
|
try:
|
||||||
cnt = json.loads(input)
|
cnt = json.loads(input)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
cnt = ast.literal_eval(input)
|
||||||
print(json.dumps(cnt.get('${node_id_upper}', {})))
|
print(json.dumps(cnt.get('${node_id_upper}', {})))
|
||||||
" > /etc/puppet/hieradata/${node_id_upper}.json
|
" > /etc/puppet/hieradata/${node_id_upper}.json
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue