From 183fce6d99c473cd83279c1eea4a00a19994fd7b Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 8 Aug 2012 20:27:33 -0400 Subject: [PATCH] Detect SFTP disablement in paramiko + changelog updates --- CHANGELOG.md | 8 ++++++++ lib/ansible/runner/connection/paramiko_ssh.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95545ad91a..c546d8e3b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ Ansible Changes By Release * I can barely see the roadmap from the heat coming off of it. * login_unix_socket option for mysql user and database modules (see PR #781 for doc notes) +* new modules -- pip, easy_install, apt_repository, supervisorctl +* ansible --version will now give branch/SHA information if running from git +* error handling for setup module when SELinux is in a weird state +* misc yum module fixes +* better sudo permissions when encountering different umasks +* YAML syntax errors detected and show where the problem is +* better changed=True/False detection in user module on older Linux distros +* when using paramiko and SFTP is not accessible, do not traceback, but return a nice human readable msg 0.6 "Cabo" -- August 6, 2012 diff --git a/lib/ansible/runner/connection/paramiko_ssh.py b/lib/ansible/runner/connection/paramiko_ssh.py index d0fac063b2..27e6ef4bd0 100644 --- a/lib/ansible/runner/connection/paramiko_ssh.py +++ b/lib/ansible/runner/connection/paramiko_ssh.py @@ -122,7 +122,10 @@ class ParamikoConnection(object): ''' transfer a file from local to remote ''' if not os.path.exists(in_path): raise errors.AnsibleFileNotFound("file or module does not exist: %s" % in_path) - sftp = self.ssh.open_sftp() + try: + sftp = self.ssh.open_sftp() + except: + raise errors.AnsibleError("failed to open a SFTP connection") try: sftp.put(in_path, out_path) except IOError: @@ -131,7 +134,10 @@ class ParamikoConnection(object): def fetch_file(self, in_path, out_path): ''' save a remote file to the specified path ''' - sftp = self.ssh.open_sftp() + try: + sftp = self.ssh.open_sftp() + except: + raise errors.AnsibleError("failed to open a SFTP connection") try: sftp.get(in_path, out_path) except IOError: