diff options
| author | Mohammed Junaid <junaid@redhat.com> | 2012-05-21 15:47:28 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-05-25 10:22:16 -0700 | 
| commit | 69392d4daa9df0612630813713ae02a99cc068e0 (patch) | |
| tree | f02a7eb5731c385a0fbd712b30f17074f9ad33ef /swift/1.4.8/plugins/DiskFile.py | |
| parent | 65275d048bb031f93a690c69cb32bb751298c212 (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/3440
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 815e1c3ab54..6f77eaaa57a 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  | 
