Skip to content

Commit

Permalink
Added a file for all hosts to be listed.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihirpandya committed Apr 26, 2015
1 parent c1f01f1 commit 66ae6a6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
54.186.238.205
54.68.89.235
16 changes: 15 additions & 1 deletion vmms/distDocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ class DistDocker:
"-o", "StrictHostKeyChecking=no",
"-o", "GSSAPIAuthentication=no"]

HOSTS_FILE = 'hosts'

def __init__(self):
""" Checks if the machine is ready to run docker containers.
Initialize boot2docker if running on OS X.
"""
try:
self.log = logging.getLogger("DistDocker")
self.hosts = ['54.186.238.205', '54.68.89.235']
self.hosts = self.readHosts()
self.hostIdx = 0
self.hostLock = threading.Lock()
self.hostUser = "ubuntu"
Expand All @@ -84,6 +86,18 @@ def __init__(self):
self.log.error(str(e))
exit(1)

def readHosts(self):
f = open(self.HOSTS_FILE, 'r')
hosts = []
hosts_str = f.read()
hosts_l = hosts_str.split('\n')
for host in hosts_l:
if len(host) > 0:
hosts.append(host)
self.log.info("Current host machines: %s" % hosts)
return hosts


def instanceName(self, id, name):
""" instanceName - Constructs a Docker instance name. Always use
this function when you need a Docker instance name. Never generate
Expand Down

0 comments on commit 66ae6a6

Please sign in to comment.