Module: check_mk
Branch: master
Commit: b15f1aa168d534d0b6aba1c2fff91a0e641f776d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b15f1aa168d534…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 21 18:11:46 2016 +0100
mkbackup: Cleaned up subprocess calls involving shell
Change-Id: If0f452058d7e26a1229a9470b2e585f4a25e74f0
---
bin/mkbackup | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/bin/mkbackup b/bin/mkbackup
index 5b5a7f2..f0da654 100755
--- a/bin/mkbackup
+++ b/bin/mkbackup
@@ -668,20 +668,26 @@ def do_site_backup(opts, site=None, try_stop=True):
def stop_site(site):
- omd_command("stop", site)
+ site_arg = [ site ] if is_root() else []
+
+ omd_command("stop", *site_arg)
for c in range(5):
- if os.system("omd status --bare %s >/dev/null" % site) >> 8 ==
1:
+ if subprocess.call(["omd", "status", "--bare" ] +
site_arg,
+ stdout=open(os.devnull, "w")) == 1:
break
elif c == 4:
raise MKGeneralException("Failed to stop site")
def start_site(site):
- omd_command("start", site)
+ site_arg = [ site ] if is_root() else []
+
+ omd_command("start", *site_arg)
for c in range(5):
- if os.system("omd status --bare %s >/dev/null" % site) >> 8 ==
0:
+ if subprocess.call(["omd", "status", "--bare", ] +
site_arg,
+ stdout=open(os.devnull, "w")) == 0:
break
elif c == 4:
raise MKGeneralException("Failed to start site")