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:
@@ -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')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user