Skip to content

Commit dc0aea5

Browse files
committed
Fix command validation
1 parent 13e828d commit dc0aea5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

atomic-update.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ def sigint_handler(signum, frame):
153153
print(f"atomic-update v{VERSION}")
154154
sys.exit()
155155

156-
# Validate command args
156+
# Validate command
157+
if not COMMAND:
158+
print(f"No valid command provided. See usage below.\n")
159+
print(help_text.strip())
160+
sys.exit(1)
157161
if COMMAND == "run" and not ARG:
158162
print(f"No argument provided for command {COMMAND!r}. See usage below.\n")
159163
print(help_text.strip())
@@ -341,7 +345,7 @@ def sigint_handler(signum, frame):
341345
sys.exit(9)
342346
logging.info("Command run successfully")
343347
if SHELL:
344-
logging.info(f"Opening bash shell within snapshot {atomic_snap} chroot")
348+
logging.info(f"Opening bash shell within chroot of snapshot {atomic_snap}")
345349
logging.info("Continue with 'exit' or discard with 'exit 1'")
346350
ret = os.system(f"chroot {snap_dir} env PS1='atomic-update:${{PWD}} # ' bash --noprofile --norc")
347351
if ret != 0:

0 commit comments

Comments
 (0)