Skip to content

Commit

Permalink
fix not being able to deploy unit config.ini files
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Oct 30, 2022
1 parent faa7332 commit 5ee711a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from flask import g

NAME = "pioreactorui"
VERSION = "22.10.0"

env = dotenv_values(".env") # a dictionary

# set up logging
Expand Down
8 changes: 5 additions & 3 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,12 @@ def save_new_config():
try:
config.read_string(code) # test parser

# if editing config.ini (not a unit specific)
# test to make sure we have minimal code to run pio commands
assert config["cluster.topology"]
assert config.get("cluster.topology", "leader_hostname")
assert config.get("cluster.topology", "leader_address")
if filename == "config.ini":
assert config["cluster.topology"]
assert config.get("cluster.topology", "leader_hostname")
assert config.get("cluster.topology", "leader_address")
except configparser.DuplicateSectionError as e:
msg = f"Duplicate section [{e.section}] was found."
publish_to_error_log(msg, "save_new_config")
Expand Down

0 comments on commit 5ee711a

Please sign in to comment.