Rename osync to objsync

Rename osync to objsync to avoid confusion with O_SYNC.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
This commit is contained in:
Colin Patrick McCabe 2011-03-22 04:15:22 -07:00
parent 45c6dbfe34
commit 21786afe19
2 changed files with 20 additions and 20 deletions

View File

@ -12,7 +12,7 @@
# #
""" """
osync.py: the object synchronizer objsync.py: the object synchronizer
""" """
from boto.s3.connection import OrdinaryCallingFormat from boto.s3.connection import OrdinaryCallingFormat
@ -313,23 +313,23 @@ def delete_unreferenced(src, dst):
dst.remove(dobj) dst.remove(dobj)
USAGE = """ USAGE = """
osync synchronizes objects. The source and destination can both be local or objsync synchronizes objects. The source and destination can both be local or
both remote. both remote.
Examples: Examples:
# copy contents of mybucket to disk # copy contents of mybucket to disk
osync -v s3://myhost/mybucket file://mydir objsync -v s3://myhost/mybucket file://mydir
# copy contents of mydir to an S3 bucket # copy contents of mydir to an S3 bucket
osync -v file://mydir s3://myhost/mybucket objsync -v file://mydir s3://myhost/mybucket
# synchronize two S3 buckets # synchronize two S3 buckets
SRC_AKEY=foo SRC_SKEY=foo \ SRC_AKEY=foo SRC_SKEY=foo \
DST_AKEY=foo DST_SKEY=foo \ DST_AKEY=foo DST_SKEY=foo \
osync -v s3://myhost/mybucket1 s3://myhost/mybucket2 objsync -v s3://myhost/mybucket1 s3://myhost/mybucket2
Note: You must specify an AWS access key and secret access key when accessing Note: You must specify an AWS access key and secret access key when accessing
S3. osync honors these environment variables: S3. objsync honors these environment variables:
SRC_AKEY Access key for the source URL SRC_AKEY Access key for the source URL
SRC_SKEY Secret access key for the source URL SRC_SKEY Secret access key for the source URL
DST_AKEY Access key for the destination URL DST_AKEY Access key for the destination URL
@ -340,7 +340,7 @@ SKEY Secret access key for both source and dest
If these environment variables are not given, we will fall back on libboto If these environment variables are not given, we will fall back on libboto
defaults. defaults.
osync (options) [source] [destination]""" objsync (options) [source] [destination]"""
parser = OptionParser(USAGE) parser = OptionParser(USAGE)
parser.add_option("-n", "--dry-run", action="store_true", \ parser.add_option("-n", "--dry-run", action="store_true", \

View File

@ -12,7 +12,7 @@
# #
""" """
osync_test.py: a system test for osync objsync_test.py: a system test for objsync
""" """
from optparse import OptionParser from optparse import OptionParser
@ -33,16 +33,16 @@ def getenv(e):
else: else:
return None return None
def osync(src, dst, misc): def objsync(src, dst, misc):
full = ["./osync.py"] full = ["./objsync.py"]
e = {} e = {}
if (isinstance(src, OsyncTestBucket)): if (isinstance(src, ObjSyncTestBucket)):
full.append(src.url) full.append(src.url)
e["SRC_AKEY"] = src.akey e["SRC_AKEY"] = src.akey
e["SRC_SKEY"] = src.skey e["SRC_SKEY"] = src.skey
else: else:
full.append(src) full.append(src)
if (isinstance(dst, OsyncTestBucket)): if (isinstance(dst, ObjSyncTestBucket)):
full.append(dst.url) full.append(dst.url)
e["DST_AKEY"] = dst.akey e["DST_AKEY"] = dst.akey
e["DST_SKEY"] = dst.skey e["DST_SKEY"] = dst.skey
@ -51,10 +51,10 @@ def osync(src, dst, misc):
full.extend(misc) full.extend(misc)
return subprocess.call(full, stderr=opts.error_out, env=e) return subprocess.call(full, stderr=opts.error_out, env=e)
def osync_check(src, dst, opts): def objsync_check(src, dst, opts):
ret = osync(src, dst, opts) ret = objsync(src, dst, opts)
if (ret != 0): if (ret != 0):
raise RuntimeError("call to osync failed!") raise RuntimeError("call to objsync failed!")
def cleanup_tempdir(): def cleanup_tempdir():
if tdir != None and opts.keep_tempdir == False: if tdir != None and opts.keep_tempdir == False:
@ -72,8 +72,8 @@ def count_obj_in_dir(d):
num_objects = num_objects + 1 num_objects = num_objects + 1
return num_objects return num_objects
###### OsyncTestBucket ####### ###### ObjSyncTestBucket #######
class OsyncTestBucket(object): class ObjSyncTestBucket(object):
def __init__(self, url, akey, skey): def __init__(self, url, akey, skey):
self.url = url self.url = url
self.akey = akey self.akey = akey
@ -108,14 +108,14 @@ if (not os.environ.has_key("URL1")):
if (opts.verbose): if (opts.verbose):
print "no bucket urls were given. Running local tests only." print "no bucket urls were given. Running local tests only."
elif (not os.environ.has_key("URL2")): elif (not os.environ.has_key("URL2")):
opts.buckets.append(OsyncTestBucket(getenv("URL1"), getenv("AKEY1"), opts.buckets.append(ObjSyncTestBucket(getenv("URL1"), getenv("AKEY1"),
getenv("SKEY1"))) getenv("SKEY1")))
if (opts.verbose): if (opts.verbose):
print "have scratch1_url: will test bucket transfers" print "have scratch1_url: will test bucket transfers"
else: else:
opts.buckets.append(OsyncTestBucket(getenv("URL1"), getenv("AKEY1"), opts.buckets.append(ObjSyncTestBucket(getenv("URL1"), getenv("AKEY1"),
getenv("SKEY1"))) getenv("SKEY1")))
opts.buckets.append(OsyncTestBucket(getenv("URL2"), getenv("AKEY2"), opts.buckets.append(ObjSyncTestBucket(getenv("URL2"), getenv("AKEY2"),
getenv("SKEY2"))) getenv("SKEY2")))
if (opts.verbose): if (opts.verbose):
print "have both scratch1_url and scratch2_url: will test \ print "have both scratch1_url and scratch2_url: will test \