Browse Source

Merge "per_node is not parsing generated json" into stable/victoria

changes/55/775655/1
Zuul 6 months ago
committed by Gerrit Code Review
parent
commit
bf71a052d3
  1. 12
      puppet/extraconfig/pre_deploy/per_node.yaml

12
puppet/extraconfig/pre_deploy/per_node.yaml

@ -45,18 +45,26 @@ resources:
# the data of the NodeDataLookup parameter that matches the
# system UUID
echo $node_lookup | $(get_python) -c "
import ast
import json
import sys
input = sys.stdin.readline() or '{}'
cnt = json.loads(input)
try:
cnt = json.loads(input)
except json.decoder.JSONDecodeError:
cnt = ast.literal_eval(input)
print(json.dumps(cnt.get('${node_id}', {})))
" > /etc/puppet/hieradata/${node_id}.json
# handle upper case node id LP#1816652
echo $node_lookup | $(get_python) -c "
import ast
import json
import sys
input = sys.stdin.readline() or '{}'
cnt = json.loads(input)
try:
cnt = json.loads(input)
except json.decoder.JSONDecodeError:
cnt = ast.literal_eval(input)
print(json.dumps(cnt.get('${node_id_upper}', {})))
" > /etc/puppet/hieradata/${node_id_upper}.json

Loading…
Cancel
Save