Пример #1
0
def walktree(top, meta_list):
    for f in os.listdir(top):
        pathname = os.path.join(top, f)
        mode = os.stat(pathname)[ST_MODE]
        if S_ISDIR(mode):
            walktree(pathname, meta_list)
        elif S_ISREG(mode):
            cloudnfs.send_file(pathname, pathname)
            cloudnfs.create_entry(pathname, meta_list)
        # We don't cover symbolic links or stuff like that yet...
        else:
            print 'Skipping %s' % pathname
Пример #2
0
    tmpFile.write(data)
    dstName = vals[2]

    "Catch exception of creating new dictionary"
    try:
        table = open('table.pkl', 'rb')
    # Happens if table.pkl does not exist
    except IOError:
        table_create = open('table.pkl', 'wb')
        table_dict = {vals[0]: vals[2]}
        pickle.dump(table_dict, table_create)
        table_create.close()
    else:
        table_dict = pickle.load(table)
        table.close()
        new_table = open('table.pkl', 'w+b')
        if table_dict.has_key(vals[0]):
            "Duplicate? Should we not do anything?"
        else:
            table_dict[vals[0]] = vals[2]
        pickle.dump(table_dict, new_table)
        new_table.close()

    # send the write to GS
    cloudnfs.send_file(tmpFile.name, dstName)
################ WHILE 1 ######################################

cloudnfs.send_file('table.pkl', 'table.pkl')

os.remove(fname)
Пример #3
0
    dstName = vals[2]

    "Catch exception of creating new dictionary"
    try:
        table = open('table.pkl', 'rb')
    # Happens if table.pkl does not exist
    except IOError:
        table_create = open('table.pkl', 'wb')
        table_dict = {vals[0]:vals[2]}
        pickle.dump(table_dict,table_create)
        table_create.close()
    else:
        table_dict = pickle.load(table)
        table.close()
        new_table = open('table.pkl', 'w+b')
        if table_dict.has_key(vals[0]):
            "Duplicate? Should we not do anything?"
        else:
            table_dict[vals[0]] = vals[2]
        pickle.dump(table_dict, new_table)
        new_table.close()
    
    # send the write to GS
    cloudnfs.send_file(tmpFile.name, dstName);
################ WHILE 1 ######################################

cloudnfs.send_file('table.pkl', 'table.pkl')

os.remove(fname)