summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Mueller <dirk@dmllr.de>2013-06-13 09:24:08 +0200
committerDirk Mueller <dirk@dmllr.de>2013-06-13 09:24:08 +0200
commitbc58e5fa70c3de71b215326c18828d874ad60e9a (patch)
tree8c5ec22ae4c6c588192cd5a37d16db34ef6207dd
parent2d00ede1e65139197f70471325b213f8241146b6 (diff)
downloadheat-cfntools-bc58e5fa70c3de71b215326c18828d874ad60e9a.tar.gz
Use Python 3.x compatible octal literals
Python 3.x deprecated octal literals in the form 0755. Use 0o755 instead which works at least with Python 2.6 and newer Change-Id: I70dc33cb674499548732408924aa2ae728e17ea3
-rw-r--r--heat_cfntools/cfntools/cfn_helper.py4
-rw-r--r--heat_cfntools/tests/test_cfn_helper.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py
index 5fa7b5a..99908bd 100644
--- a/heat_cfntools/cfntools/cfn_helper.py
+++ b/heat_cfntools/cfntools/cfn_helper.py
@@ -1107,7 +1107,7 @@ class Metadata(object):
cache_dir = os.path.dirname(last_path)
if not os.path.isdir(cache_dir):
try:
- os.makedirs(cache_dir, mode=0700)
+ os.makedirs(cache_dir, mode=0o700)
except IOError as e:
LOG.warn('could not create metadata cache dir %s [%s]' %
(cache_dir, e))
@@ -1117,7 +1117,7 @@ class Metadata(object):
with tempfile.NamedTemporaryFile(dir=tmp_dir,
mode='wb',
delete=False) as cf:
- os.chmod(cf.name, 0600)
+ os.chmod(cf.name, 0o600)
cf.write(json.dumps(self._metadata))
os.rename(cf.name, last_path)
diff --git a/heat_cfntools/tests/test_cfn_helper.py b/heat_cfntools/tests/test_cfn_helper.py
index 843f9e4..22b6b31 100644
--- a/heat_cfntools/tests/test_cfn_helper.py
+++ b/heat_cfntools/tests/test_cfn_helper.py
@@ -605,9 +605,9 @@ class TestMetadataRetrieve(testtools.TestCase):
self.assertTrue(os.path.exists(last_path),
"last_metadata file should exist")
# Ensure created dirs and file have right perms
- self.assertTrue(os.stat(last_path).st_mode & 0600 == 0600)
+ self.assertTrue(os.stat(last_path).st_mode & 0o600 == 0o600)
self.assertTrue(
- os.stat(os.path.dirname(last_path)).st_mode & 0700 == 0700)
+ os.stat(os.path.dirname(last_path)).st_mode & 0o700 == 0o700)
def test_is_valid_metadata(self):
md_data = {"AWS::CloudFormation::Init": {"config": {"files": {