Added `use_sudo` and `temp_dir` params to `operations.get()`. Fixes #700 #1121

Merged
merged 1 commit into from Sep 4, 2014

Projects

None yet

3 participants

@xarg
Contributor
xarg commented Apr 20, 2014

Also added some tests for the use_sudo + temp_dir combination for operations.put()

@bitprophet
Member

Linking to #700 since the mention in the subject didn't do so :) (and - thanks! Labeling for followup.)

@bitprophet bitprophet added this to the 1.10 milestone Aug 6, 2014
@bitprophet
Member

Merging and testing this now and there's a problem, at least on my localhost system (OS X / BSD userland) the chmod this code adds causes the file to be unreadable, resulting in an IOError from Paramiko's SFTP module, and a created-but-empty local file at the expected path.

The reason it fails is because the chmod is 0404 intending it to be root and owner readable...but the file is already owned by root at this point in time (and then when it's copied by SFTP)! I.e. sudo cp creates a new file owned by root, not by the original owner.

Both BSD and Linux versions of cp seem to support the -p flag which preserves user/group/timestamps - this feels more like what we want anyways. I am adding this for now.

@bitprophet bitprophet merged commit 305f2a6 into fabric:master Sep 4, 2014
@j-san
j-san commented Jun 8, 2015

Does not work yet for directories :)

example: get('/data/media/', use_sudo=True)

The problem comes from sftp.glob
The glob function does not suppert use_sudo param. Called from fabric.operations.get

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment