Truncate docker-compose.yaml to zero bytes
Truncate docker-compose.yaml to zero bytes before writing the updated config. Otherwise, if the existing config size is more than the new config, trash is left behind. Change-Id: I3d9628e53a4a100f333bab62fd775ab164179ec0
This commit is contained in:
@@ -107,7 +107,8 @@ def write_compose_config(c):
|
||||
proj_dir = os.path.join(DOCKER_COMPOSE_DIR, c['name'])
|
||||
prepare_dir(proj_dir)
|
||||
fn = os.path.join(proj_dir, 'docker-compose.yml')
|
||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
|
||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o600),
|
||||
'w') as f:
|
||||
f.write(yaml_config.encode('utf-8'))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user