mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Hosts file not updated when IP is passed as option
When an IPA server with unresolvable hostname is being installed, a hostname record must be inserted to /etc/hosts or the installation will fail. However, it is not inserted when IP address is passed as an option (--ip-address) and not interactively. This patch fixes this so that /etc/hosts record is inserted in both cases. https://fedorahosted.org/freeipa/ticket/2074
This commit is contained in:
parent
62c110a3b8
commit
0165a03694
@ -754,10 +754,14 @@ def main():
|
|||||||
|
|
||||||
# Check we have a public IP that is associated with the hostname
|
# Check we have a public IP that is associated with the hostname
|
||||||
hostaddr = resolve_host(host_name)
|
hostaddr = resolve_host(host_name)
|
||||||
|
ip_add_to_hosts = False
|
||||||
if hostaddr is not None:
|
if hostaddr is not None:
|
||||||
ip = CheckedIPAddress(hostaddr, match_local=True)
|
ip = CheckedIPAddress(hostaddr, match_local=True)
|
||||||
else:
|
else:
|
||||||
|
# hostname is not resolvable
|
||||||
ip = options.ip_address
|
ip = options.ip_address
|
||||||
|
ip_add_to_hosts = True
|
||||||
|
|
||||||
if ip is None:
|
if ip is None:
|
||||||
print "Unable to resolve IP address for host name"
|
print "Unable to resolve IP address for host name"
|
||||||
if options.unattended:
|
if options.unattended:
|
||||||
@ -772,11 +776,9 @@ def main():
|
|||||||
|
|
||||||
ip = options.ip_address
|
ip = options.ip_address
|
||||||
|
|
||||||
ip_add_to_hosts = False
|
|
||||||
if ip is None:
|
if ip is None:
|
||||||
ip = read_ip_address(host_name, fstore)
|
ip = read_ip_address(host_name, fstore)
|
||||||
logging.debug("read ip_address: %s\n" % str(ip))
|
logging.debug("read ip_address: %s\n" % str(ip))
|
||||||
ip_add_to_hosts = True
|
|
||||||
|
|
||||||
ip_address = str(ip)
|
ip_address = str(ip)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user