Use Python 3.x compatible octal literals

Python 3.x deprecated the 0700 construct. 0o700
works with any version of Python (>= 2.6 tested)

Change-Id: I47fcb79804b75437e6cf4ce966fbfdc05fce26cd
changes/61/32361/1
Dirk Mueller 10 years ago
parent 760e1b151a
commit ede21a2688

@ -24,7 +24,7 @@ def init_logging():
LOG.setLevel(logging.INFO)
LOG.addHandler(logging.StreamHandler())
fh = logging.FileHandler("/var/log/heat-provision.log")
os.chmod(fh.baseFilename, 0600)
os.chmod(fh.baseFilename, 0o600)
LOG.addHandler(fh)
@ -65,7 +65,7 @@ def main():
return -1
userdata_path = os.path.join(VAR_PATH, 'cfn-userdata')
os.chmod(userdata_path, 0700)
os.chmod(userdata_path, 0o700)
LOG.info('Provision began: %s\n' % datetime.datetime.now())
returncode = call([userdata_path])

@ -12,7 +12,7 @@ def list_types():
def handle_part(data, ctype, filename, payload):
if ctype == "__begin__":
try:
os.makedirs('/var/lib/heat-cfntools', 0700)
os.makedirs('/var/lib/heat-cfntools', 0o700)
except OSError as e:
if e.errno != errno.EEXIST:
raise

@ -87,7 +87,7 @@ class LoguserdataTest(HeatTestCase):
pkg_resources.get_distribution('cloud-init').AndReturn(
FakeCiVersion('0.7.0'))
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0700).AndReturn(None)
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0o700).AndReturn(None)
subprocess.Popen(
['/var/lib/heat-cfntools/cfn-userdata'],
stderr=mox.IgnoreArg(),
@ -102,7 +102,7 @@ class LoguserdataTest(HeatTestCase):
pkg_resources.get_distribution('cloud-init').AndReturn(
FakeCiVersion('0.7.0'))
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0700).AndReturn(None)
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0o700).AndReturn(None)
subprocess.Popen(
['/var/lib/heat-cfntools/cfn-userdata'],
stderr=mox.IgnoreArg(),
@ -119,7 +119,7 @@ class LoguserdataTest(HeatTestCase):
pkg_resources.get_distribution('cloud-init').AndReturn(
FakeCiVersion('0.7.0'))
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0700).AndReturn(None)
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0o700).AndReturn(None)
subprocess.Popen(
['/var/lib/heat-cfntools/cfn-userdata'],
stderr=mox.IgnoreArg(),
@ -134,7 +134,7 @@ class LoguserdataTest(HeatTestCase):
def test_main_error_other(self):
pkg_resources.get_distribution('cloud-init').AndReturn(
FakeCiVersion('0.7.0'))
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0700).AndReturn(None)
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0o700).AndReturn(None)
subprocess.Popen(
['/var/lib/heat-cfntools/cfn-userdata'],
stderr=mox.IgnoreArg(),
@ -153,7 +153,7 @@ class LoguserdataTest(HeatTestCase):
pkg_resources.get_distribution('cloud-init').AndReturn(
FakeCiVersion('0.7.0'))
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0700).AndReturn(None)
os.chmod('/var/lib/heat-cfntools/cfn-userdata', 0o700).AndReturn(None)
subprocess.Popen(
['/var/lib/heat-cfntools/cfn-userdata'],
stderr=mox.IgnoreArg(),

Loading…
Cancel
Save