Set current domainname again after hostname change

This commit is contained in:
mridulnagpal 2016-11-02 23:22:45 +05:30 committed by James Valleroy
parent b7293e8d98
commit 063190a00c
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -234,6 +234,7 @@ def _apply_changes(request, old_status, new_status):
def set_hostname(hostname):
"""Sets machine hostname to hostname"""
old_hostname = get_hostname()
old_domainname = get_domainname()
# Hostname should be ASCII. If it's unicode but passed our
# valid_hostname check, convert to ASCII.
@ -250,7 +251,13 @@ def set_hostname(hostname):
old_hostname=old_hostname,
new_hostname=hostname)
# Domain name should be ASCII. If it's unicode, convert to ASCII.
domainname = old_domainname
LOGGER.info('Changing domain name to - %s', domainname)
actions.superuser_run('domainname-change', [domainname])
def set_domainname(domainname):
"""Sets machine domain name to domainname"""
old_domainname = get_domainname()