Truncate last_metadata file dumped by cfn-init hook
This patch truncates JSON-dumped metadata file (the default path should be "/var/cache/heat-cfntools/last_metadata") by cfn-init hook, and makes sure the file content includes proper metadata only. Change-Id: I313cc63012134e10165f6bfe09b1096a3cb92cc1 Closes-Bug: #1391072
This commit is contained in:
parent
5eb75ccc51
commit
cf2cf5b5da
@ -49,7 +49,8 @@ def main(argv=sys.argv, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr):
|
||||
os.makedirs(LAST_METADATA_DIR, 0o700)
|
||||
|
||||
fn = os.path.join(LAST_METADATA_DIR, 'last_metadata')
|
||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o700), 'w') as f:
|
||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o700),
|
||||
'w') as f:
|
||||
json.dump(meta, f)
|
||||
|
||||
log.debug('Running %s' % CFN_INIT_CMD)
|
||||
|
Loading…
Reference in New Issue
Block a user