Skip to content

Commit

Permalink
Fix #1470 and add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Aug 22, 2016
1 parent 0164dc6 commit 1bb422f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions fabric/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import with_statement

import errno
import os
import os.path
import posixpath
Expand Down Expand Up @@ -569,6 +570,10 @@ def get(remote_path, local_path=None, use_sudo=False, temp_dir=""):
or '*' in remote_path or '?' in remote_path
):
names = ftp.glob(remote_path)
# Handle "file not found" errors (like Paramiko does if we
# explicitly try to grab a glob-like filename).
if not names:
raise IOError(errno.ENOENT, "No such file")
else:
names = [remote_path]

Expand Down
2 changes: 1 addition & 1 deletion fabric/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def glob(self, path):
rlist = self.ftp.listdir(dirpart)

names = fnfilter([f for f in rlist if not f[0] == '.'], pattern)
ret = [path]
ret = []
if len(names):
s = '/'
ret = [dirpart.rstrip(s) + s + name.lstrip(s) for name in names]
Expand Down
5 changes: 5 additions & 0 deletions sites/www/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

* :bug:`1470` When using `~fabric.operations.get` with glob expressions, a lack
of matches for the glob would result in an empty file named after the glob
expression (in addition to raising an error). This has been fixed so the
empty file is no longer generated. Thanks to Georgy Kibardin for the catch &
initial patch.
* :support:`1483 backported` (also re: :issue:`1386`, :issue:`1374`,
:issue:`1300`) Add :ref:`an FAQ <faq-csh>` about quote problems in remote
``csh`` causing issues with Fabric's shell-wrapping and quote-escaping.
Expand Down

0 comments on commit 1bb422f

Please sign in to comment.