-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
file_upload() behavior for lcd context incompatible with fabric put() #198
Comments
Would you mind writing a standalone test case for that? The function |
Hello Sébastien, I've attached a small fabfile that demonstrates both failure modes of file_upload proper operation of put(). It seemed to me that just using fabric.utils.apply_lcwd(path,env) might not be sufficient because of the way that put() deals with non-path arguments. There is this logic
in put() for determining whether the source is a file or a path. I see that file_upload works only for paths, so fabric.utils.apply_lcwd(path,env) would work for that case, but some of the functionality of put() is lost. Thank you for addressing my issue so quickly. Ed On Fri, 11 Dec 2015, Sébastien Pierre wrote:
|
I think you forgot the attachment! |
fabfile.py.gz Cuisine adds the mode settings, which would be ignored by put(), so it's nice to be able to stay within cuisine for most things. Still, if upload_file() worked with lcd() then that would cover the most common case of copying a local path to a remote path. Thank you for creating cuisine. Whatever issues there may be with fabric and cuisine, they are still nothing compared to the pain of battling ansible as it tries to use YAML markup as a scripting language. One would have thought that imake and ant provided sufficient lessons in why that should not be done.
On Fri, 11 Dec 2015, Sébastien Pierre wrote:
|
The put() method in fabric honors lcd context, but file_upload() does not. This makes file_upload() fail whenever an lcd context is in place because the either file_upload() code or put() will use the wrong path.
To reproduce this bug just do
cd 'different_local_directory'
with lcd('local_directory'):
file_upload(target_path, 'some_file_in_local_directory')
The relevant code from put is at fabric/operations.py:364
I'd have written a patch, but the behavior of put() wrt paths is complex enough that it seems wrong to duplicate it in file_upload() w/o refactoring fabric to expose it all for reuse.
The text was updated successfully, but these errors were encountered: