recipes/machine_admin/util.py

13 lines
No EOL
251 B
Python

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):
if _DRY_RUN:
return subprocess.run(op, shell=True)
else:
logging.info(f"Dry Run | {op}")