Fix container and add dry run ability.

This commit is contained in:
James Grogan 2024-03-29 12:18:29 +00:00
parent d1b91a0a89
commit 43114d8c1f
4 changed files with 14 additions and 2 deletions

0
.gitignore vendored Normal file
View file

View file

@ -1,4 +1,4 @@
FROM debian
COPY machine_admin /
COPY machine_admin /machine_admin
COPY machine_setup.py /

View file

@ -1,4 +1,13 @@
import subprocess
import logging
_DRY_RUN = False
def set_is_dry_run(is_dry_run: bool):
_DRY_RUN = is_dry_run
def run_op(op: str):
return subprocess.run(op, shell=True)
if _DRY_RUN:
return subprocess.run(op, shell=True)
else:
logging.info(f"Dry Run | {op}")

View file

@ -12,6 +12,9 @@ if __name__ == "__main__":
parser.add_argument('--username',
help="Name of the default non-root user")
parser.add_argument('--dry_run',
help="If set then don't change the system state - used for testing.",
default = False)
args = parser.parse_args()