summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-04-11 17:47:27 +0200
committerxengineering <me@xengineering.eu>2025-04-11 17:47:27 +0200
commitacf453677e7e39c568c02189e9906d05a19c6dfa (patch)
treeefa1824291b57a3a801514a38365ce4bbab6aadc
parent617178f01c1b1acbd2e0f3e66a66f2a5f375e3c8 (diff)
downloadiot-contact-acf453677e7e39c568c02189e9906d05a19c6dfa.tar
iot-contact-acf453677e7e39c568c02189e9906d05a19c6dfa.tar.zst
iot-contact-acf453677e7e39c568c02189e9906d05a19c6dfa.zip
tools: deploy.py: Add --dry-run
This makes debugging easier and safer.
-rwxr-xr-xtools/deploy.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/tools/deploy.py b/tools/deploy.py
index 62a4ed6..84e1c6a 100755
--- a/tools/deploy.py
+++ b/tools/deploy.py
@@ -23,20 +23,27 @@ def main() -> None:
default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/main/",
help="remote path to destination folder on server",
)
+ parser.add_argument(
+ "-d",
+ "--dry-run",
+ action="store_true",
+ help="do not execute command and instead print it",
+ )
args = parser.parse_args()
- subprocess.run(
- [
- "rsync",
- "-av",
- "--delete",
- f"{str(pathlib.Path(args.artifacts))}/",
- f"{args.host}:{args.path}",
- ],
- shell=False,
- check=True,
- )
+ command = [
+ "rsync",
+ "-av",
+ "--delete",
+ f"{str(pathlib.Path(args.artifacts).resolve())}/",
+ f"{args.host}:{args.path}",
+ ]
+
+ if args.dry_run:
+ print(command)
+ else:
+ subprocess.run(command, shell=False, check=True)
if __name__ == "__main__":