abhilekhsingh / gc3pie

Automatically exported from code.google.com/p/gc3pie
0 stars 0 forks source link

Transport does not fully support recursive put() #480

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently Transport supports the recursive `put()` of a local folder but the 
way it is implemented seems to work only on 1st-level nested subfolders

when a 2nd-level folder is found, Transport.put() will run the following 
(transport.py:292):

             if os.path.isdir(source):
                # destination must be a directory
                assert self.isdir(destination), \
                    "Transport.put(): when source is a directory," \
                    " destination must be a directory, too!"

                self.makedirs(destination)

if source is the reference to a 2nd-level folder, the assert will fails as on 
the remote end the folder has not been created yet.

Simply remove the assert test (and leave the makedirs) will successfully allow 
to copy recursively any-level nested folders without impacting the original 
behavior of the Transport.put()

can we agree on this ?
I will make the change and commit right away

Sergio

Original issue reported on code.google.com by sergio.m...@gmail.com on 19 Feb 2015 at 11:05

GoogleCodeExporter commented 9 years ago
| Simply remove the assert test (and leave the makedirs) will
| successfully allow to copy recursively any-level nested folders
| without impacting the original behavior of the Transport.put()
|
| can we agree on this ?

No: that will introduce a bug; if `Transport.put()` is called with a
directory as source and a file as destination, it will make a mess and
GC3Pie will not notice.

I agree that `Transport.put()` should be recursive (or at least have a
flag allowing it to be), but this is not the way to patch it.

Original comment by riccardo.murri@gmail.com on 20 Feb 2015 at 9:20