Skip to content

Commit

Permalink
fix(config): prevented error when opt config values where missing. Up…
Browse files Browse the repository at this point in the history
…dated python output to

read only final line.
  • Loading branch information
christopherpickering committed Sep 19, 2023
1 parent d1369a3 commit a08d1d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion runner/scripts/em_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def run(self) -> Optional[List[Path]]:

# if output is not a file list, then swallow it.
try:
output = ast.literal_eval(self.output)
# just get the last line of the output to allow other
# debug statements
output = ast.literal_eval(self.output.splitlines()[-1])
if isinstance(output, List):
return output
except BaseException:
Expand Down
4 changes: 2 additions & 2 deletions runner/scripts/em_smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __init__(
self.password = app.config["SMB_PASSWORD"]
self.server_ip = app.config["SMB_SERVER_IP"]
self.server_name = app.config["SMB_SERVER_NAME"]
self.subfolder = app.config["SMB_SUBFOLDER"]
self.subfolder = app.config.get("SMB_SUBFOLDER")

self.conn = self.__connect()

Expand Down Expand Up @@ -362,7 +362,7 @@ def save(self, overwrite: int, file_name: str) -> str: # type: ignore[return]
str(self.dir.joinpath(file_name)), "rb", buffering=0
) as file_obj:
uploaded_size = self.conn.storeFile(
self.share_name, dest_path, file_obj
self.share_name, dest_path, file_obj, timeout=120
)

server_name = (
Expand Down
7 changes: 4 additions & 3 deletions runner/scripts/em_smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ def __send_ssms(self) -> None:
)
mail_server.ehlo()

if app.config["SMTP_USE_TLS"]:
if app.config.get("SMTP_USE_TLS", False):
mail_server.starttls()
mail_server.ehlo()

if app.config["SMTP_USERNAME"]:
if app.config.get("SMTP_USERNAME"):
mail_server.login(
app.config["SMTP_USERNAME"], app.config["SMTP_PASSWORD"]
app.config["SMTP_USERNAME"],
app.config.get("SMTP_PASSWORD", None),
)

mail_server.sendmail(
Expand Down

0 comments on commit a08d1d5

Please sign in to comment.