2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-21 16:39:32 +00:00

Create a copy instead of rename of /etc/hosts

By copying, we leave the /etc/hosts with original ownership/permissions/etc.

Otherwise we create a new /etc/hosts, which is subject to new permissions and such.
This commit is contained in:
Jarrod Johnson
2026-08-25 10:35:35 -04:00
parent 3496f90fb7
commit 7a0a2d0e48
+2 -1
View File
@@ -3,6 +3,7 @@ import argparse
import os
import re
import signal
import shutil
import sys
try:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
@@ -205,7 +206,7 @@ def main():
merger.add_entry(ipbynode[node], namesbynode[node])
if os.path.exists('/etc/hosts'):
merger.read_target('/etc/hosts')
os.rename('/etc/hosts', '/etc/hosts.confluentbkup')
shutil.copy2('/etc/hosts', '/etc/hosts.confluentbkup')
merger.write_out('/etc/hosts')