Skip to content

Commit

Permalink
Fix bug that when there is not environment field in nodes section
Browse files Browse the repository at this point in the history
  • Loading branch information
f9n committed Feb 28, 2019
1 parent c7f5c96 commit 7ae2ba7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cesi/core/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def check_config_file(config_file_path):
)
)

for field in CESI_CONF_SCHEMA.keys():
_field = configurations.get(field, None)
if _field is None:
sys.exit(
"Failed to read '{0}' configuration file. You must write '{1}' section.".format(
config_file_path, field
)
field_name = "cesi"
_field = configurations.get(field_name, None)
if _field is None:
sys.exit(
"Failed to read '{0}' configuration file. You must write '{1}' section.".format(
config_file_path, field_name
)
)

return configurations

Expand All @@ -70,7 +70,7 @@ def parse_config_file(config_file_path):

for node in configurations.get("nodes", []):
node_name = node["name"]
node_environment = node["environment"] or "default"
node_environment = node.get("environment", "default")
node_names.add(node_name)
node_environments.add(node_environment)

Expand Down

0 comments on commit 7ae2ba7

Please sign in to comment.