Exemplo n.º 1
0
    #
    celestefs.verbose = True
    

    #
    # Ensure that the credential corresponding to myId and myPassword exists.
    #
    if not celestefs.credentialExists(myId):
        celestefs.mkid()

    #
    # Now do the same thing for the file system in which inFileName's to be
    # stored.
    #
    if not celestefs.fileSystemExists(fileSystemName):
        celestefs.mkfs(fileSystemName, fileSystemPassword)
    #
    # Belt and suspenders sanity check:  Verify that the create succeeded.
    #
    if not celestefs.fileSystemExists(fileSystemName):
        #
        # Bail out.  Either we couldn't create the file system or something
        # else is wrong; in either case, it's not evident how to recover.
        #
        print >> stderr, "%s non-inspectable; aborting" % fileSystemName
        sys.exit(1)

    #
    # Obtain the name of the file to ingest.  If it's not specified on the
    # command line, use "/etc/passwd" as a modest-sized default.
    #
Exemplo n.º 2
0
    #
    # Ensure that the credential corresponding to myId and myPassword exists.
    #
    if not celestefs.credentialExists(myId):
        celestefs.mkid()

    #
    # Now do the same thing for the file system in which the directory and its
    # entries are to live.
    #
    if not celestefs.fileSystemExists(fileSystemName):
        fsAttrs = {
            "MaintainSerialNumbers" : "false"
        }
        celestefs.mkfs(fileSystemName, fileSystemPassword, attrs=fsAttrs)

    nameGen = FileNameGenerator(20)

    #
    # XXX:  The code below assumes that name collisions won't happen.
    #       Assuming that self.rv is freshly seeded each time (as advertised
    #       in the documentation for the random module), a violation of this
    #       assumption should be negligibly improbable.
    #

    #
    # Create the directory that will hold the individual entries.
    #
    dirAttrs = {
        #"CacheEnabled" : "false",
Exemplo n.º 3
0
from celestefs import Celestefs
from sys import exit, stderr

if __name__ == "__main__":

    name = "offsetTest"

    c = Celestefs(name, name)
    c.verbose = True

    if not c.credentialExists(name):
        c.mkid()

    if not c.fileSystemExists(name):
        if not c.mkfs(name, name):
            print "mkfs(%s, %s) failed" % (name, name)
            exit(1)

    filename = "/" + name + "/" + "file"

    #
    # Create or truncate the test file, as approriate.
    #
    if not c.fileExists(filename):
        createAttrs = {
            # "BlockSize" : "3"
            # "BlockSize" : "16"
        }
        c.create(filename, contentType="text/plain", attrs=createAttrs)
    else: