Permalink
Browse files

Basic error checking for herd.py

  • Loading branch information...
1 parent 7435266 commit bcb94465863c236af87bc289d1799260cedd4b30 @neogenix neogenix committed Jan 30, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 herd.py
View
7 herd.py
@@ -3,7 +3,6 @@
import sys
import os
import time
-from greenlet import GreenletExit
import eventlet
from eventlet.green import socket
from eventlet.green import subprocess
@@ -97,5 +96,11 @@ def local_ip():
if __name__ == '__main__':
+ if len(sys.argv) < 3:
+ sys.exit('ERROR: This command requires 3 command line options')
+
+ if not os.path.exists(sys.argv[3]):
+ sys.exit('ERROR: hosts file "%s" does not exist' % sys.argv[3])
+
hosts = [line.strip() for line in open(sys.argv[3], 'r') if line[0] != '#']
run(sys.argv[1], sys.argv[2], hosts)

0 comments on commit bcb9446

Please sign in to comment.