Commit 33da8a98 authored by Kirk Webb's avatar Kirk Webb

Allow specification of server in geni-get (-s server).

Also update my mothership defs file.
parent f25d292f
...@@ -45,6 +45,7 @@ def usage(): ...@@ -45,6 +45,7 @@ def usage():
print " -c, --client-version display client version" print " -c, --client-version display client version"
print " -h, --help show this message" print " -h, --help show this message"
print " -n, --no-cache disable reading cached results" print " -n, --no-cache disable reading cached results"
print " -s, --server specify server name/address"
print " -p, --port specify server port" print " -p, --port specify server port"
print " -v, --version display server version" print " -v, --version display server version"
print "" print ""
...@@ -60,12 +61,13 @@ def dump( sock ): ...@@ -60,12 +61,13 @@ def dump( sock ):
sock.close() sock.close()
try: try:
opts, args = getopt.getopt( sys.argv[ 1: ], "achnp:v", [ "all", "client-version", "help", "no-cache", "port=", "version" ] ) opts, args = getopt.getopt( sys.argv[ 1: ], "achns:p:v", [ "all", "client-version", "help", "no-cache", "server=", "port=", "version" ] )
except getopt.GetoptError as err: except getopt.GetoptError as err:
print str( err ) print str( err )
usage() usage()
sys.exit( 1 ) sys.exit( 1 )
server = None
port = PORT port = PORT
command = None command = None
...@@ -81,6 +83,8 @@ for opt, param in opts: ...@@ -81,6 +83,8 @@ for opt, param in opts:
elif opt in ( "-n", "--no-cache" ): elif opt in ( "-n", "--no-cache" ):
# Ignored; we don't currently cache anyway... # Ignored; we don't currently cache anyway...
pass pass
elif opt in ( "-s", "--server" ):
server = param
elif opt in ( "-p", "--port" ): elif opt in ( "-p", "--port" ):
port = int( param ) port = int( param )
elif opt in ( "-v", "--version" ): elif opt in ( "-v", "--version" ):
...@@ -94,17 +98,20 @@ if command == None: ...@@ -94,17 +98,20 @@ if command == None:
sys.exit( 1 ) sys.exit( 1 )
# Our tmcd server is also our DNS server, so that's how we find it. # Our tmcd server is also our DNS server, so that's how we find it.
resolv_conf = open( "/etc/resolv.conf", "r" ) if not server:
for line in resolv_conf.readlines(): resolv_conf = open( "/etc/resolv.conf", "r" )
match = re.search( r"nameserver\s+([0-9.]+)", line ) for line in resolv_conf.readlines():
if match: match = re.search( r"nameserver\s+([0-9.]+)", line )
server = match.group( 1 ) if match:
break server = match.group( 1 )
else: break
print >> sys.stderr, sys.argv[ 0 ] + ": unable to find server address" else:
sys.exit( 1 ) print >> sys.stderr, sys.argv[ 0 ] + ": unable to find server address"
sys.exit( 1 )
resolv_conf.close()
resolv_conf.close() # This is a no-op if 'server' is an IP address.
server = socket.gethostbyname(server)
sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
sock.connect( (server, port) ) sock.connect( (server, port) )
......
...@@ -14,7 +14,8 @@ TBTESTSUITEEMAIL=kwebb@flux.utah.edu ...@@ -14,7 +14,8 @@ TBTESTSUITEEMAIL=kwebb@flux.utah.edu
WWW=www.emulab.net/dev/kwebb WWW=www.emulab.net/dev/kwebb
THISHOMEBASE=Kwebb.Emulab.Net THISHOMEBASE=Kwebb.Emulab.Net
ELVIN_COMPAT=0 PORTAL_ENABLE=1
PROTOGENI_SUPPORT=0 PORTAL_ISPRIMARY=1
WINDOWS_KEY_7PRO_X86=FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
WINSUPPORT=1 #PROTOGENI_SUPPORT=0
#WINSUPPORT=1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment