Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

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

Open
nephomaniac opened this issue May 4, 2016 · 1 comment
Open

Comments

@nephomaniac
Copy link

nephomaniac commented May 4, 2016

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
Copy link
Author

See #114

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant