put urls in constants, sanity check to make sure wget succeeded
smbaker [Sun, 9 Dec 2012 21:28:04 +0000 (13:28 -0800)]
scripts/init.py

index 5634cf2..ce76680 100755 (executable)
@@ -11,6 +11,11 @@ import getpass
 INSANE = 500
 BLOCKING_DELAY = 30
 
+HTML_SOURCE = "www.vicci.org/files/mpi/"
+MPI_COPY_URL = HTML_SOURCE + "mpi-copy.py"
+GENERATE_HOSTFILE_URL = HTML_SOURCE + "generate-hostfile.py"
+SSHD_CONFIG_URL = HTML_SOURCE + "sshd_config"
+
 
 def alarm(signum, junk):
     # Do nothing, default implementation does needful
@@ -62,14 +67,20 @@ def fetch_output_nofail(inpath,outpath):
 
 ### main()
 
-
-os.system("wget -q -O /usr/bin/mpi-copy.py www.cs.arizona.edu/~dkl/mpi-copy.py")
-os.system("wget -q -O /usr/bin/generate-hostfile.py www.cs.arizona.edu/~dkl/generate-hostfile.py")
-os.system("wget -q -O /tmp/sshd_config www.cs.arizona.edu/~dkl/sshd_config")
+os.system("wget -q -O /usr/bin/mpi-copy.py " + MPI_COPY_URL)
+os.system("wget -q -O /usr/bin/generate-hostfile.py " + GENERATE_HOSTFILE_URL)
+os.system("wget -q -O /tmp/sshd_config " + SSHD_CONFIG_URL)
 
 os.system("chmod 755 /usr/bin/mpi-copy.py")
 os.system("chmod 755 /usr/bin/generate-hostfile.py")
 
+for fn in ["/usr/bin/mpi-copy.py", "/usr/bin/generate-hostfile.py", "/tmp/sshd_config"]:
+    if not os.path.exists(fn):
+        print "missing", fn
+        sys.exit(-1)
+    if os.path.getsize(fn)==0:
+        print "zero byte file", fn
+        sys.exit(-1)
 
 f = open("/etc/slicename", "r")
 homedir = "/home/" + f.read()