From c93d7fdd19cf3783360c6c973f52aa90e39cb462 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sat, 8 Jun 2013 10:59:13 +0200 Subject: [PATCH] Use Python 3.x compatible octal numbers Unfortunately, Python 3.x deprecated support for 0755 octal numbers. Use 0o755 instead. Change-Id: I70403d382d6e6569445b6a99954ea24d436f29ad --- cinder/tests/image/fake.py | 2 +- cinder/tests/test_utils.py | 4 ++-- cinder/volume/drivers/scality.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cinder/tests/image/fake.py b/cinder/tests/image/fake.py index 814b3bd82..6df9ce2d8 100644 --- a/cinder/tests/image/fake.py +++ b/cinder/tests/image/fake.py @@ -37,7 +37,7 @@ class _FakeImageService(object): self.images = {} # NOTE(justinsb): The OpenStack API can't upload an image? # So, make sure we've got one.. - timestamp = datetime.datetime(2011, 01, 01, 01, 02, 03) + timestamp = datetime.datetime(2011, 1, 1, 1, 2, 3) image1 = {'id': '155d900f-4e14-4e4c-a73d-069cbf4541e6', 'name': 'fakeimage123456', diff --git a/cinder/tests/test_utils.py b/cinder/tests/test_utils.py index 2c807ed19..b7ea0729b 100644 --- a/cinder/tests/test_utils.py +++ b/cinder/tests/test_utils.py @@ -64,7 +64,7 @@ echo $runs > "$1" exit 1 ''') fp.close() - os.chmod(tmpfilename, 0755) + os.chmod(tmpfilename, 0o755) self.assertRaises(exception.ProcessExecutionError, utils.execute, tmpfilename, tmpfilename2, attempts=10, @@ -109,7 +109,7 @@ echo foo > "$1" grep foo ''') fp.close() - os.chmod(tmpfilename, 0755) + os.chmod(tmpfilename, 0o755) utils.execute(tmpfilename, tmpfilename2, process_input='foo', diff --git a/cinder/volume/drivers/scality.py b/cinder/volume/drivers/scality.py index bf16339d1..0cad54ba0 100644 --- a/cinder/volume/drivers/scality.py +++ b/cinder/volume/drivers/scality.py @@ -109,7 +109,7 @@ class ScalityDriver(driver.VolumeDriver): def _create_file(self, path, size): with open(path, "ab") as f: f.truncate(size) - os.chmod(path, 0666) + os.chmod(path, 0o666) def _copy_file(self, src_path, dest_path): self._execute('dd', 'if=%s' % src_path, 'of=%s' % dest_path, -- 2.45.2