X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fhostmap.py;h=6a71ec27fe3e227130a2302c0804b4c0a624b423;hb=7b50fb7fc973b74fe81b5000febebc5657432508;hp=3d030e6c35c33df5f87c806559b40e6aeb9329e3;hpb=3c23b137553cc676568871aaff425456cda51fdd;p=nodemanager.git diff --git a/plugins/hostmap.py b/plugins/hostmap.py index 3d030e6..6a71ec2 100644 --- a/plugins/hostmap.py +++ b/plugins/hostmap.py @@ -1,5 +1,5 @@ """ -Configure interfaces inside a container by pulling down files via URL. +Update /etc/hosts in slivers to contain the contents of the sliver_hostmap tag. """ import logger @@ -52,14 +52,14 @@ def GetSlivers(data, config=None, plc=None): for index, entry in enumerate(tag["value"].split("\n")): parts = entry.split(" ") if len(parts)==2: - if parts[1] == hostname: - line = "127.0.0.1 %s.%s private%d" % (slicename, parts[1], index) - else: - line = "%s %s.%s private%d" % (parts[0], slicename, parts[1], index) + line = "%s pvt.%s private%d" % (parts[0], parts[1], index) if (index==0): line = line + " headnode" + if parts[1] == hostname: + line = line + " pvt.self" + hostmap.append(line) hostmap = "\n".join(hostmap) @@ -71,7 +71,7 @@ def GetSlivers(data, config=None, plc=None): # remove anything between PREFIX and SUFFIX from contents - pattern = PREFIX + ".*" + SUFFIX + pattern = PREFIX + ".*" + SUFFIX + "\n" regex = re.compile(pattern, re.DOTALL) if regex.search(contents) != None: contents = regex.sub(hostmap, contents) @@ -84,4 +84,3 @@ def GetSlivers(data, config=None, plc=None): logger.log_exc("hostmap (%s): failed to write %s" % (slicename, fn)) -