eucalyptus / calyptos

Tool for Managing Eucalyptus
BSD 2-Clause "Simplified" License
5 stars 14 forks source link

Calyptos incorrectly relies upon hostname as the node file prefix #104

Open nephomaniac opened 8 years ago

nephomaniac commented 8 years ago

When Calyptos attempts to pull the remote host node file(s) it uses a remote filename built with the hostname as the prefix ie: .json. This is actually the DNS resolved name of the primary ip. This should be changed from run('hostname') to socket.gethostbyaddr(primary ip of host). These is needed for nat'd VMs, in this case a VM in the cloud will have an internal and external name... Sample of what this might look like (assuming we can replace the run('hostname') portion at the top?...

def pull_node_info(self):
        hostname = run('hostname')
        try:
            hostname = socket.gethostbyaddr(hostname)[0]
        except Exception as E:
            print red('Warning error during hostname lookup:"{0}", err:"{1}"'.format(hostname, E))
        local_path = 'chef-repo/nodes/' + str(hostname) + '.json'
        remote_path = self.remote_folder_path + local_path
        try:
            if self.local_hostname != run('hostname'):
                get(remote_path=remote_path, local_path=local_path)
                self.read_node_hash(local_path)
        except Exception as E:
            print red('Failed to download node info. Localpath:{0}, remotepath:{1}'.format(local_path, remote_path))
            raise E
nephomaniac commented 8 years ago

See https://github.com/eucalyptus/calyptos/pull/114