mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Abstract procedures for IP address warnings
Originaly there should be only two occurencees of this warning, one for server, one for client. But obviously is not possible with current installers to achive this goal, so I have to extract code to not mess with 5 times copy and paste. https://fedorahosted.org/freeipa/ticket/5814 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
committed by
David Kupka
parent
271a4f0982
commit
1c96ff7a6c
@@ -31,7 +31,11 @@ from ipaplatform.paths import paths
|
||||
from ipaplatform.tasks import tasks
|
||||
from ipalib import api, constants, errors, x509
|
||||
from ipalib.constants import CACERT
|
||||
from ipalib.util import validate_domain_name
|
||||
from ipalib.util import (
|
||||
validate_domain_name,
|
||||
network_ip_address_warning,
|
||||
broadcast_ip_address_warning,
|
||||
)
|
||||
import ipaclient.ntpconf
|
||||
from ipaserver.install import (
|
||||
bindinstance, ca, cainstance, certs, dns, dsinstance,
|
||||
@@ -609,19 +613,8 @@ def install_check(installer):
|
||||
not installer.interactive, False,
|
||||
options.ip_addresses)
|
||||
|
||||
for ip in ip_addresses:
|
||||
if ip.is_network_addr():
|
||||
root_logger.warning("IP address %s might be network address", ip)
|
||||
# fixme: once when loggers will be fixed, we can remove this print
|
||||
print(
|
||||
"WARNING: IP address {} might be network address".format(ip),
|
||||
file=sys.stderr)
|
||||
if ip.is_broadcast_addr():
|
||||
root_logger.warning("IP address %s might be broadcast address", ip)
|
||||
# fixme: once when loggers will be fixed, we can remove this print
|
||||
print(
|
||||
"WARNING: IP address {} might be broadcast address".format(ip),
|
||||
file=sys.stderr)
|
||||
network_ip_address_warning(ip_addresses)
|
||||
broadcast_ip_address_warning(ip_addresses)
|
||||
|
||||
# installer needs to update hosts file when DNS subsystem will be
|
||||
# installed or custom addresses are used
|
||||
|
||||
@@ -13,7 +13,6 @@ import dns.reversename as dnsreversename
|
||||
import os
|
||||
import shutil
|
||||
import socket
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import six
|
||||
@@ -28,6 +27,10 @@ from ipaplatform import services
|
||||
from ipaplatform.tasks import tasks
|
||||
from ipaplatform.paths import paths
|
||||
from ipalib import api, certstore, constants, create_api, errors, rpc, x509
|
||||
from ipalib.util import (
|
||||
network_ip_address_warning,
|
||||
broadcast_ip_address_warning,
|
||||
)
|
||||
import ipaclient.ipachangeconf
|
||||
import ipaclient.ntpconf
|
||||
from ipaserver.install import (
|
||||
@@ -736,27 +739,8 @@ def install_check(installer):
|
||||
config.host_name, not installer.interactive, False,
|
||||
options.ip_addresses)
|
||||
|
||||
for ip in config.ips:
|
||||
if ip.is_network_addr():
|
||||
root_logger.warning(
|
||||
"IP address %s might be network address", ip)
|
||||
# fixme: once when loggers will be fixed, we can remove this
|
||||
# print
|
||||
print(
|
||||
"WARNING: IP address {} might be network address".format(
|
||||
ip),
|
||||
file=sys.stderr
|
||||
)
|
||||
if ip.is_broadcast_addr():
|
||||
root_logger.warning(
|
||||
"IP address %s might be broadcast address", ip)
|
||||
# fixme: once when loggers will be fixed, we can remove this
|
||||
# print
|
||||
print(
|
||||
"WARNING: IP address {} might be broadcast address".format(
|
||||
ip),
|
||||
file=sys.stderr
|
||||
)
|
||||
network_ip_address_warning(config.ips)
|
||||
broadcast_ip_address_warning(config.ips)
|
||||
|
||||
except errors.ACIError:
|
||||
raise ScriptError("\nThe password provided is incorrect for LDAP server "
|
||||
@@ -1329,25 +1313,8 @@ def promote_check(installer):
|
||||
config.host_name, not installer.interactive,
|
||||
False, options.ip_addresses)
|
||||
|
||||
for ip in config.ips:
|
||||
if ip.is_network_addr():
|
||||
root_logger.warning(
|
||||
"IP address %s might be network address", ip)
|
||||
# fixme: once when loggers will be fixed, we can remove this
|
||||
# print
|
||||
print(
|
||||
"WARNING: IP address {} might be network address".format(
|
||||
ip), file=sys.stderr
|
||||
)
|
||||
if ip.is_broadcast_addr():
|
||||
root_logger.warning(
|
||||
"IP address %s might be broadcast address", ip)
|
||||
# fixme: once when loggers will be fixed, we can remove this
|
||||
# print
|
||||
print(
|
||||
"WARNING: IP address {} might be broadcast address".format(
|
||||
ip), file=sys.stderr
|
||||
)
|
||||
network_ip_address_warning(config.ips)
|
||||
broadcast_ip_address_warning(config.ips)
|
||||
|
||||
except errors.ACIError:
|
||||
raise ScriptError("\nInsufficient privileges to promote the server.")
|
||||
|
||||
Reference in New Issue
Block a user