Fix update listener certs doesn't work

This change fixes listener update sni-container-refs
doesn't work by adding O_TRUNC flag to upload_certificate method

Change-Id: I59664615e1ef5e46a99c12256dbe02f89ecf4c0b
This commit is contained in:
wu.chunyang 2021-11-17 22:43:42 +08:00
parent 3c5bbbc189
commit d340a1de50
2 changed files with 6 additions and 1 deletions

View File

@ -387,7 +387,7 @@ class Loadbalancer(object):
stream = Wrapped(flask.request.stream)
file = self._cert_file_path(lb_id, filename)
flags = os.O_WRONLY | os.O_CREAT
flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC
# mode 00600
mode = stat.S_IRUSR | stat.S_IWUSR
with os.fdopen(os.open(file, flags, mode), 'wb') as crt_file:

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fix update listener certs failed. The fix ensures
that an existing certificate gets overwritten properly.