replace json with yaml

every JSON file is also a valid YAML file
see: http://yaml.org/spec/1.2/spec.html#id2759572
This commit is contained in:
adobdin 2016-05-28 15:58:03 +00:00
parent 1adc36ae24
commit 076562d0e7

View File

@ -19,7 +19,7 @@
main module main module
""" """
import json import yaml
import os import os
import shutil import shutil
import logging import logging
@ -371,15 +371,9 @@ class NodeManager(object):
self.nodes = {} self.nodes = {}
self.fuel_init() self.fuel_init()
if nodes_json: if nodes_json:
try: self.nodes_json = tools.load_yaml_file(nodes_json)
with open(nodes_json, 'r') as json_data:
self.nodes_json = json.load(json_data)
except:
logging.error(('NodeManager __init__: cannot load data from'
' file "%s"') % nodes_json)
sys.exit(6)
else: else:
self.nodes_json = json.loads(self.get_nodes_json()) self.nodes_json = yaml.load(self.get_nodes_json())
self.nodes_init() self.nodes_init()
# apply soft-filter on all nodes # apply soft-filter on all nodes
for node in self.nodes.values(): for node in self.nodes.values():