summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--swift/1.4.8/plugins/utils.py9
-rw-r--r--swift/1.4.8/test/unit/plugins/test_utils.py8
2 files changed, 8 insertions, 9 deletions
diff --git a/swift/1.4.8/plugins/utils.py b/swift/1.4.8/plugins/utils.py
index a25cbc3b8f4..1e666d70999 100644
--- a/swift/1.4.8/plugins/utils.py
+++ b/swift/1.4.8/plugins/utils.py
@@ -481,7 +481,7 @@ def get_container_details(cont_path, memcache=None):
"""
if memcache:
object_list, object_count, bytes_used = get_container_details_from_memcache(cont_path, cont_path,
- memcache=memcache)
+ memcache)
else:
object_list, object_count, bytes_used = get_container_details_from_fs(cont_path, cont_path)
@@ -524,7 +524,7 @@ def get_account_details(acc_path, memcache=None):
else:
return get_account_details_from_fs(acc_path, memcache)
-def get_etag(path):
+def _get_etag(path):
etag = md5()
with open(path, 'rb') as fp:
while True:
@@ -553,7 +553,7 @@ def get_object_metadata(obj_path):
X_CONTENT_TYPE: DIR_TYPE if is_dir else FILE_TYPE,
X_OBJECT_TYPE: DIR if is_dir else FILE,
X_CONTENT_LENGTH: 0 if is_dir else stats.st_size,
- X_ETAG: md5().hexdigest() if is_dir else get_etag(obj_path),
+ X_ETAG: md5().hexdigest() if is_dir else _get_etag(obj_path),
}
return metadata
@@ -573,8 +573,7 @@ def get_container_metadata(cont_path, memcache=None):
objects = []
object_count = 0
bytes_used = 0
- objects, object_count, bytes_used = get_container_details(cont_path,
- memcache=memcache)
+ objects, object_count, bytes_used = get_container_details(cont_path, memcache)
metadata = {X_TYPE: CONTAINER,
X_TIMESTAMP: normalize_timestamp(os.path.getctime(cont_path)),
X_PUT_TIMESTAMP: normalize_timestamp(os.path.getmtime(cont_path)),
diff --git a/swift/1.4.8/test/unit/plugins/test_utils.py b/swift/1.4.8/test/unit/plugins/test_utils.py
index 70081a7d26e..0731c78656b 100644
--- a/swift/1.4.8/test/unit/plugins/test_utils.py
+++ b/swift/1.4.8/test/unit/plugins/test_utils.py
@@ -291,14 +291,14 @@ class TestUtils(unittest.TestCase):
def test_get_etag_empty(self):
tf = tempfile.NamedTemporaryFile()
- hd = utils.get_etag(tf.name)
+ hd = utils._get_etag(tf.name)
assert hd == hashlib.md5().hexdigest()
def test_get_etag(self):
tf = tempfile.NamedTemporaryFile()
tf.file.write('123' * utils.CHUNK_SIZE)
tf.file.flush()
- hd = utils.get_etag(tf.name)
+ hd = utils._get_etag(tf.name)
tf.file.seek(0)
md5 = hashlib.md5()
while True:
@@ -335,7 +335,7 @@ class TestUtils(unittest.TestCase):
assert md[utils.X_CONTENT_TYPE] == utils.FILE_TYPE
assert md[utils.X_CONTENT_LENGTH] == os.path.getsize(tf.name)
assert md[utils.X_TIMESTAMP] == normalize_timestamp(os.path.getctime(tf.name))
- assert md[utils.X_ETAG] == utils.get_etag(tf.name)
+ assert md[utils.X_ETAG] == utils._get_etag(tf.name)
def test_get_object_metadata_dir(self):
td = tempfile.mkdtemp()
@@ -372,7 +372,7 @@ class TestUtils(unittest.TestCase):
assert md[utils.X_CONTENT_TYPE] == utils.FILE_TYPE
assert md[utils.X_CONTENT_LENGTH] == os.path.getsize(tf.name)
assert md[utils.X_TIMESTAMP] == normalize_timestamp(os.path.getctime(tf.name))
- assert md[utils.X_ETAG] == utils.get_etag(tf.name)
+ assert md[utils.X_ETAG] == utils._get_etag(tf.name)
def test_create_object_metadata_dir(self):
td = tempfile.mkdtemp()