a little printf debug
[mirror/dsa-puppet.git] / modules / roles / files / static-mirroring / static-master-run
index 24ea3e1..d9aa164 100755 (executable)
@@ -5,6 +5,7 @@ import os
 import shutil
 import subprocess
 import string
+import sys
 import tempfile
 import time
 
@@ -15,9 +16,12 @@ subdirs = { 'master': 'master',       # where updates from off-site end up going
 serialname = '.serial'
 
 clients = []
-with open('/home/staticsync/etc/static-clients') as f:
+with open('/etc/static-clients.conf') as f:
   for line in f:
-    clients.append(line.strip())
+    line = line.strip()
+    if line == "": continue
+    if line.startswith('#'): continue
+    clients.append(line)
 
 def log(m):
   t = time.strftime("[%Y-%m-%d %H:%M:%S]", time.gmtime())
@@ -159,15 +163,21 @@ def run_mirror():
     log("Cleaning up.")
     shutil.rmtree(tmpdir_old)
     log("Done.")
+    return True
   else:
     log("Aborted.")
+    return False
 
 
+ok = False
 try:
-  run_mirror()
+  ok = run_mirror()
 finally:
   for p in cleanup_dirs:
     if os.path.exists(p): shutil.rmtree(p)
+
+if not ok:
+  sys.exit(1)
 # vim:set et:
 # vim:set ts=2:
 # vim:set shiftwidth=2: