Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#8 Failure to create dir in remote job

closed
nobody
None
5
2004-07-31
2004-01-07
Mark Carter
No

If a directory is specified in Remote inputs, but doesn't
exist, then Dirssync doesn't create it; even though it
should.

To reproduce the bug, run the following code:

import dirssync
import dstest
from dirssync import *

log = BasicLog()
log.quiet = True
ForceRemoveDir("remote", log)
ForceRemoveDir("local", log)
os.makedirs("remote/dir")
os.makedirs("local")
listdirs = {}
listdirs[0] = ('remote/dir', 'local/dir')
t = transfer()
t.log = log
actions = t.analyse(listdirs)
SyncList(actions, t.log, t.options)
assert(exists("local/dir"))

--end

Update() should probably add the remote directory to its
list of actions if it doesn't exist.

Discussion

  • vincent delft
    vincent delft
    2004-07-31

    • status: open --> closed
     
  • vincent delft
    vincent delft
    2004-07-31

    Logged In: YES
    user_id=106404

    Solved with DirsSync2:
    Try the following:
    #build test data
    for root, dirs, files in os.walk('tmp', topdown=False):
    for name in files:
    os.remove(os.path.join(root, name))
    for name in dirs:
    os.rmdir(os.path.join(root, name))
    os.makedirs('tmp/t1')
    os.makedirs('tmp/t2')
    open('tmp/t1/test1','w').write('test1')
    open('tmp/t2/test2','w').write('test2')
    os.makedirs('tmp/t1/toto/titi')
    open('tmp/t1/toto/titi/test','w').write('test')
    #build dirssync objects
    loc=DirDesc('tmp/t1')
    rem=DirDesc('tmp/t2')
    job=Job(loc,rem)
    result=DateComp(job)
    #we just confirm that dirssync must perform all
    synchronisation
    confirmation=[1 for elem in result.getresult()]
    result.perform(confirmation)