diff --git a/calyptos/chefmanager.py b/calyptos/chefmanager.py index 4b98c5f..00571fe 100644 --- a/calyptos/chefmanager.py +++ b/calyptos/chefmanager.py @@ -186,10 +186,12 @@ def clear_node_info(self): with hide('running'): return run('knife node bulk delete -z -E {0} -y ".*"'.format(self.environment_name)) - def run_chef_client(self, chef_command="chef-client -z"): + def run_chef_client(self, chef_command="chef-client -z", hide_opts=None): with cd(self.remote_folder_path + 'chef-repo'): - with hide('running'): - return run(chef_command + " -E " + self.environment_name + " -l info") + hide_opts = hide_opts or [] + with hide(*hide_opts): + return run("{0} -E {1} -N $(hostname) -l info".format(chef_command, + self.environment_name)) def push_deployment_data(self): with hide(*self.hidden_outputs): @@ -199,8 +201,14 @@ def push_deployment_data(self): ssh_opts=self.ssh_opts, delete=True) def pull_node_info(self): - local_path = 'chef-repo/nodes/' + run('hostname') + '.json' + hostname = run('hostname') + local_path = 'chef-repo/nodes/' + str(hostname) + '.json' remote_path = self.remote_folder_path + local_path - if self.local_hostname != run('hostname'): - get(remote_path=remote_path, local_path=local_path) - self.read_node_hash(local_path) + try: + if self.local_hostname != 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