[networkcfg] fix python crash

open(path, "w") returns a TextIOWrapper,
open(path, "wb") returns a BufferedWriter,
.. neither of which is one of the types that os.chmod()
   consumes. Use fileno(), an integer file-descriptor.

FIXES #2294
This commit is contained in:
Adriaan de Groot 2024-02-27 22:16:14 +01:00
parent 1f3ebad92d
commit 5568d22549

View File

@ -155,7 +155,7 @@ network:
"""
with open(renderer_file, 'w') as f:
f.writelines(nm_renderer)
os.chmod(f, 0o600)
os.chmod(f.fileno(), 0o600)
# Copy existing Netplan configuration
for cfg in glob.glob(os.path.join(source_netplan, "*.yaml")):