Skip to content

Commit 9715d48

Browse files
authored
Weathertop: Fix flake8 issue in deploy.py (#6969)
1 parent cdcb9de commit 9715d48

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.tools/test/stacks/deploy.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import yaml
88
import time
9-
import logging
109
import re
1110

1211

@@ -31,9 +30,12 @@ def run_shell_command(command, env_vars=None):
3130
try:
3231
output = subprocess.check_output(command, stderr=subprocess.STDOUT, env=env)
3332
print(f"Command output: {output.decode()}")
34-
except Exception as e:
33+
except subprocess.CalledProcessError as e:
3534
print(f"Error executing command: {e.output.decode()}")
3635
raise
36+
except Exception as e:
37+
print(f"Exception executing command: {e!r}")
38+
raise
3739

3840

3941
def validate_alphanumeric(value, name):
@@ -100,6 +102,8 @@ def main():
100102
parser.add_argument("type", choices=["admin", "images", "plugin"])
101103
args = parser.parse_args()
102104

105+
accounts = None
106+
103107
if args.type in {"admin", "images"}:
104108
try:
105109
with open("config/resources.yaml", "r") as file:
@@ -119,6 +123,9 @@ def main():
119123
except Exception as e:
120124
print(f"Failed to read config data: \n{e}")
121125

126+
if accounts is None:
127+
raise ValueError(f"Could not load accounts for stack {args.type}")
128+
122129
for account_name, account_info in accounts.items():
123130
print(
124131
f"Reading from account {account_name} with ID {account_info['account_id']}"

0 commit comments

Comments
 (0)