diff options
author | Martin Basti <mbasti@redhat.com> | 2015-09-01 19:05:01 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2015-09-03 16:01:30 +0200 |
commit | 0bcf0c1be9be99a0301051eef048fac9b178f735 (patch) | |
tree | b94a1454a32a363a4858765fed7dfd831ec0e1be /ipaserver/install/server | |
parent | 0c5e41cc79f75e12094773cdf5a296dd06052763 (diff) | |
download | freeipa-0bcf0c1be9be99a0301051eef048fac9b178f735.tar.gz freeipa-0bcf0c1be9be99a0301051eef048fac9b178f735.tar.xz freeipa-0bcf0c1be9be99a0301051eef048fac9b178f735.zip |
Installer: do not modify /etc/hosts before user agreement
https://fedorahosted.org/freeipa/ticket/4561
As side effect this also fixes:
https://fedorahosted.org/freeipa/ticket/5266
Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipaserver/install/server')
-rw-r--r-- | ipaserver/install/server/install.py | 14 | ||||
-rw-r--r-- | ipaserver/install/server/replicainstall.py | 12 |
2 files changed, 23 insertions, 3 deletions
diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py index dfaf67d0d..f9baa0757 100644 --- a/ipaserver/install/server/install.py +++ b/ipaserver/install/server/install.py @@ -34,7 +34,8 @@ from ipaserver.install import ( otpdinstance, replication, service, sysupgrade) from ipaserver.install.installutils import ( IPA_MODULES, BadHostError, get_fqdn, get_server_ip_address, - is_ipa_configured, load_pkcs12, read_password, verify_fqdn) + is_ipa_configured, load_pkcs12, read_password, verify_fqdn, + update_hosts_file) from ipaserver.plugins.ldap2 import ldap2 try: @@ -610,10 +611,15 @@ def install_check(installer): dns.install_check(False, False, options, host_name) ip_addresses = dns.ip_addresses else: - ip_addresses = get_server_ip_address(host_name, fstore, + ip_addresses = get_server_ip_address(host_name, not installer.interactive, False, options.ip_addresses) + # installer needs to update hosts file when DNS subsystem will be + # installed or custom addresses are used + if options.ip_addresses or options.setup_dns: + installer._update_hosts_file = True + print() print("The IPA Master Server will be configured with:") print("Hostname: %s" % host_name) @@ -712,6 +718,9 @@ def install(installer): # configure /etc/sysconfig/network to contain the custom hostname tasks.backup_and_replace_hostname(fstore, sstore, host_name) + if installer._update_hosts_file: + update_hosts_file(ip_addresses, host_name, fstore) + # Create DS user/group if it doesn't exist yet dsinstance.create_ds_user() @@ -1497,6 +1506,7 @@ class Server(common.Installable, common.Interactive, core.Composite): self._external_cert_file = None self._external_ca_file = None self._ca_cert = None + self._update_hosts_file = False #pylint: disable=no-member diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py index bd78c75d0..c36548e7a 100644 --- a/ipaserver/install/server/replicainstall.py +++ b/ipaserver/install/server/replicainstall.py @@ -504,11 +504,17 @@ def install_check(installer): if options.setup_dns: dns.install_check(False, True, options, config.host_name) + config.ips = dns.ip_addresses else: config.ips = installutils.get_server_ip_address( - config.host_name, fstore, not installer.interactive, False, + config.host_name, not installer.interactive, False, options.ip_addresses) + # installer needs to update hosts file when DNS subsystem will be + # installed or custom addresses are used + if options.setup_dns or options.ip_addresses: + installer._update_hosts_file = True + # check connection if not options.skip_conncheck: replica_conn_check( @@ -530,6 +536,9 @@ def install(installer): dogtag_constants = dogtag.install_constants + if installer._update_hosts_file: + installutils.update_hosts_file(config.ips, config.host_name, fstore) + # Create DS user/group if it doesn't exist yet dsinstance.create_ds_user() @@ -787,6 +796,7 @@ class Replica(common.Installable, common.Interactive, core.Composite): self._top_dir = None self._config = None + self._update_hosts_file = False #pylint: disable=no-member |