From 481d2226b1d442d0e63e69a04a9dafe4eb5d7b9f Mon Sep 17 00:00:00 2001 From: Varun Mittal Date: Tue, 13 Oct 2015 14:17:31 +0530 Subject: [PATCH] Remove keyword arguments from os.open call, instead add check for mode bits The open() method of OS module don't have any keyword arguments and would fail with exceptions if **kwargs is passed. Instead, I have added mode as named argument with 0o777 as default mode for os.open() call Change-Id: I5628883f4fb5ef7f08944673b0e5cc09bc166540 Signed-off-by: Varun Mittal --- swiftonfile/swift/common/fs_utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/swiftonfile/swift/common/fs_utils.py b/swiftonfile/swift/common/fs_utils.py index be96d1d..1899268 100644 --- a/swiftonfile/swift/common/fs_utils.py +++ b/swiftonfile/swift/common/fs_utils.py @@ -183,13 +183,13 @@ def do_fstat(fd): return stats -def do_open(path, flags, **kwargs): +def do_open(path, flags, mode=0o777): try: - fd = os.open(path, flags, **kwargs) + fd = os.open(path, flags, mode) except OSError as err: raise SwiftOnFileSystemOSError( - err.errno, '%s, os.open("%s", %x, %r)' % ( - err.strerror, path, flags, kwargs)) + err.errno, '%s, os.open("%s", %x, %o)' % ( + err.strerror, path, flags, mode)) return fd