mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix /etc/hosts not being modified when hostname is changed
Fixes #42926
This commit is contained in:
parent
9b27473763
commit
a3b2e19149
1 changed files with 1 additions and 8 deletions
|
@ -2027,19 +2027,12 @@ def build_network_settings(**settings):
|
|||
# Write settings
|
||||
_write_file_network(network, _DEB_NETWORKING_FILE, True)
|
||||
|
||||
# Write hostname to /etc/hostname
|
||||
# Get hostname and domain from opts
|
||||
sline = opts['hostname'].split('.', 1)
|
||||
opts['hostname'] = sline[0]
|
||||
hostname = '{0}\n' . format(opts['hostname'])
|
||||
current_domainname = current_network_settings['domainname']
|
||||
current_searchdomain = current_network_settings['searchdomain']
|
||||
|
||||
# Only write the hostname if it has changed
|
||||
if not opts['hostname'] == current_network_settings['hostname']:
|
||||
if not ('test' in settings and settings['test']):
|
||||
# TODO replace wiht a call to network.mod_hostname instead
|
||||
_write_file_network(hostname, _DEB_HOSTNAME_FILE)
|
||||
|
||||
new_domain = False
|
||||
if len(sline) > 1:
|
||||
new_domainname = sline[1]
|
||||
|
|
Loading…
Add table
Reference in a new issue