Fix overwriting downloaded config files
When we wrote downloaded config files over previously existing ones,
we sometimes got garbled files with remainders of the previous state,
e.g.:
step_4:
keystone_refresh:
action: exec
command:
- keystone
- pkill
- --signal
- USR1
- httpd
start_order: 1
user: root
start_order: 1
user: root
This was because we opened the file for writing but didn't truncate
its size, so this commit adds O_TRUNC to the flags for opening
files. It's very similar to bug 1434187 which we had a long time ago.
Revert "Fix deploy health checks"
Depends-On: Ia2c12d7455564b6297c5f0934812b10fabbdc914
Change-Id: Ib1d3c68ec3c4048ffc7277daf84834288ea50e48
Closes-Bug: #1783866
(cherry picked from commit f6767eb21c
)
This commit is contained in:
parent
0c3398ebf9
commit
3eedf929e8
|
@ -105,9 +105,8 @@ class Config(object):
|
|||
|
||||
@staticmethod
|
||||
def _open_file(path):
|
||||
return os.fdopen(os.open(path,
|
||||
os.O_WRONLY | os.O_CREAT, 0o600),
|
||||
'w')
|
||||
return os.fdopen(
|
||||
os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w')
|
||||
|
||||
def _write_playbook_get_tasks(self, tasks, role, filepath):
|
||||
playbook = []
|
||||
|
|
Loading…
Reference in New Issue