diff options
author | Mohammed Junaid <junaid@redhat.com> | 2012-05-21 15:47:28 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-05-21 22:14:39 -0700 |
commit | 93893b9ac06479bdfe28f94fce961594b928121a (patch) | |
tree | 4db2b2f1e7757d78c6161685b6b8919f3e75be1a /swift/1.4.8/plugins/DiskFile.py | |
parent | afc623f85e766a9006d7ba7cb81123ca3e10a719 (diff) |
swift: Passing account name in container_update.
This patch also contains fixes to bugs
* 811501
* 812498
* 821310
Also, removed the default set of users in the proxy-server.conf file.
Change-Id: Ief83905d10ff7bf7c43685ada4d7f05959cee9d1
BUG: 821310
Signed-off-by: Mohammed Junaid <junaid@redhat.com>
Reviewed-on: http://review.gluster.com/3390
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'swift/1.4.8/plugins/DiskFile.py')
-rw-r--r-- | swift/1.4.8/plugins/DiskFile.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/swift/1.4.8/plugins/DiskFile.py b/swift/1.4.8/plugins/DiskFile.py index 815e1c3ab..6f77eaaa5 100644 --- a/swift/1.4.8/plugins/DiskFile.py +++ b/swift/1.4.8/plugins/DiskFile.py @@ -15,6 +15,8 @@ import os from eventlet import tpool +from tempfile import mkstemp +from contextlib import contextmanager from swift.common.utils import normalize_timestamp, renamer from swift.plugins.utils import mkdirs, rmdirs, validate_object, \ check_valid_account, create_object_metadata, do_open, \ @@ -294,3 +296,21 @@ class Gluster_DiskFile(DiskFile): if X_OBJECT_TYPE in self.metadata: self.metadata.pop(X_OBJECT_TYPE) + @contextmanager + def mkstemp(self): + """Contextmanager to make a temporary file.""" + + if not os.path.exists(self.tmpdir): + mkdirs(self.tmpdir) + fd, tmppath = mkstemp(dir=self.tmpdir) + try: + yield fd, tmppath + finally: + try: + os.close(fd) + except OSError: + pass + try: + os.unlink(tmppath) + except OSError: + pass |