keep old file permission workaround

This commit is contained in:
htmltiger 2022-04-16 23:46:51 +01:00 committed by GitHub
parent 5616917064
commit 74d9e6efb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,11 +90,12 @@ async def websocket_create(hass, connection, msg):
except: except:
mode = 0o666 mode = 0o666
with AtomicWriter(fullpath, overwrite=True).open() as fdesc: with AtomicWriter(fullpath, overwrite=True).open() as fdesc:
fdesc.write(content)
with open(fullpath, 'a') as fdesc:
try: try:
os.fchmod(fdesc.fileno(), mode) os.fchmod(fdesc.fileno(), mode)
except: except:
pass pass
fdesc.write(content)
except: except:
res = "Saving Failed" res = "Saving Failed"
_LOGGER.exception(res+": %s", fullpath) _LOGGER.exception(res+": %s", fullpath)