mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Remove NTP server role while upgrading
Remove NTP server role from config.py. Remove uneccesary variables and replaced untrack_file with restore_file. Update typo in manpages and messages printed while installing. Resolves: https://pagure.io/freeipa/issue/7024 Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
committed by
Rob Crittenden
parent
ece56ea69a
commit
dba87a47a7
@@ -116,7 +116,7 @@ Configure chronyd to use this NTP server. This option can be used multiple times
|
|||||||
Configure chronyd to use this NTP server pool.
|
Configure chronyd to use this NTP server pool.
|
||||||
.TP
|
.TP
|
||||||
\fB\-N\fR, \fB\-\-no\-ntp\fR
|
\fB\-N\fR, \fB\-\-no\-ntp\fR
|
||||||
Do not configure NTP client (chornyd).
|
Do not configure NTP client (chronyd).
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-force\-chrony\fR
|
\fB\-\-force\-chrony\fR
|
||||||
Stop and disable any time&date synchronization services besides chronyd.
|
Stop and disable any time&date synchronization services besides chronyd.
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ Configure chronyd to use this NTP server. This option can be used multiple times
|
|||||||
Configure chronyd to use this NTP server pool.
|
Configure chronyd to use this NTP server pool.
|
||||||
.TP
|
.TP
|
||||||
\fB\-N\fR, \fB\-\-no\-ntp\fR
|
\fB\-N\fR, \fB\-\-no\-ntp\fR
|
||||||
Do not configure NTP client (chornyd).
|
Do not configure NTP client (chronyd).
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-force\-chrony\fR
|
\fB\-\-force\-chrony\fR
|
||||||
Stop and disable any time&date synchronization services besides chronyd.
|
Stop and disable any time&date synchronization services besides chronyd.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ Configure chronyd to use this NTP server. This option can be used multiple times
|
|||||||
Configure chronyd to use this NTP server pool.
|
Configure chronyd to use this NTP server pool.
|
||||||
.TP
|
.TP
|
||||||
\fB\-N\fR, \fB\-\-no\-ntp\fR
|
\fB\-N\fR, \fB\-\-no\-ntp\fR
|
||||||
Do not configure NTP client (chornyd).
|
Do not configure NTP client (chronyd).
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-force\-chrony\fR
|
\fB\-\-force\-chrony\fR
|
||||||
Stop and disable any time&date synchronization services besides chronyd.
|
Stop and disable any time&date synchronization services besides chronyd.
|
||||||
|
|||||||
@@ -2347,9 +2347,9 @@ def update_ipa_nssdb():
|
|||||||
|
|
||||||
def sync_time(options, fstore, statestore, force):
|
def sync_time(options, fstore, statestore, force):
|
||||||
"""
|
"""
|
||||||
Will disable any other time synchronization service if there is
|
Will disable any other time synchronization service if the --force-chrony
|
||||||
--force-chrony option set, and configure chrony with given ntp(chrony)
|
option set, and configure chrony with given ntp(chrony) server and/or pool
|
||||||
server and/or pool using Augeas in configure_chrony method.
|
using Augeas in configure_chrony method.
|
||||||
If there is no option --ntp-server set IPADiscovery will try to find ntp
|
If there is no option --ntp-server set IPADiscovery will try to find ntp
|
||||||
server in DNS records.
|
server in DNS records.
|
||||||
"""
|
"""
|
||||||
@@ -2372,18 +2372,19 @@ def sync_time(options, fstore, statestore, force):
|
|||||||
if ntp_servers:
|
if ntp_servers:
|
||||||
if timeconf.configure_chrony(ntp_servers, options.ntp_pool,
|
if timeconf.configure_chrony(ntp_servers, options.ntp_pool,
|
||||||
fstore, statestore):
|
fstore, statestore):
|
||||||
print("Done Configuring chrony.")
|
print("Done configuring chrony.")
|
||||||
else:
|
else:
|
||||||
print("Warning: IPA Server was unable to sync time with chrony!")
|
print("Warning: IPA was unable to sync time with chrony!")
|
||||||
print(" Time synchronization is required for IPA Server "
|
print(" Time synchronization is required for IPA "
|
||||||
"to work correctly")
|
"to work correctly")
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Unable to sync time with chrony server, assuming the time "
|
"Unable to sync time with chrony server, assuming the time "
|
||||||
"is in sync. Please check that 123 UDP port is opened, "
|
"is in sync. Please check that 123 UDP port is opened, "
|
||||||
"and any time server is on network.")
|
"and any time server is on network.")
|
||||||
else:
|
else:
|
||||||
print("Warning: chrony not configured, using default configuration.")
|
print("Warning: Skipping chrony configuration. "
|
||||||
logger.warning("No SRV records of NTP servers found nor NTP server "
|
"The default configuration will be used.")
|
||||||
|
logger.warning("No SRV records of NTP servers found and no NTP server "
|
||||||
"address was provided. Skipping chrony configuration, "
|
"address was provided. Skipping chrony configuration, "
|
||||||
"default configuration will be used")
|
"default configuration will be used")
|
||||||
|
|
||||||
@@ -3477,7 +3478,7 @@ class ClientInstallInterface(hostname_.HostNameInstallInterface,
|
|||||||
None, False,
|
None, False,
|
||||||
deprecated=True,
|
deprecated=True,
|
||||||
description="Stop and disable any time&date synchronization services "
|
description="Stop and disable any time&date synchronization services "
|
||||||
"besides ntpd.\n"
|
"besides ntpd. "
|
||||||
"This option has been obsoleted by --force-chrony",
|
"This option has been obsoleted by --force-chrony",
|
||||||
)
|
)
|
||||||
force_ntpd = enroll_only(force_ntpd)
|
force_ntpd = enroll_only(force_ntpd)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from ipapython import dnsutil
|
|||||||
from ipapython.dn import DN
|
from ipapython.dn import DN
|
||||||
from ipaplatform.constants import constants
|
from ipaplatform.constants import constants
|
||||||
from ipaplatform.paths import paths
|
from ipaplatform.paths import paths
|
||||||
|
from ipaserver import servroles
|
||||||
from ipaserver.install import installutils
|
from ipaserver.install import installutils
|
||||||
from ipaserver.install import dsinstance
|
from ipaserver.install import dsinstance
|
||||||
from ipaserver.install import httpinstance
|
from ipaserver.install import httpinstance
|
||||||
@@ -1608,24 +1609,31 @@ def ntpd_cleanup(fqdn, fstore):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info("Service ntpd was not disabled or stopped")
|
logger.info("Service ntpd was not disabled or stopped")
|
||||||
|
|
||||||
ntpd_files = [paths.NTP_CONF, paths.NTP_STEP_TICKERS, paths.SYSCONFIG_NTPD]
|
for ntpd_file in [paths.NTP_CONF, paths.NTP_STEP_TICKERS,
|
||||||
for ntpd_file in ntpd_files:
|
paths.SYSCONFIG_NTPD]:
|
||||||
try:
|
try:
|
||||||
fstore.untrack_file(ntpd_file)
|
fstore.restore_file(ntpd_file)
|
||||||
os.remove(ntpd_file)
|
|
||||||
except IOError:
|
|
||||||
logger.warning(
|
|
||||||
"No access to the %s, file could not be deleted.", ntpd_file)
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.warning("Error: %s", e)
|
logger.warning(e)
|
||||||
|
|
||||||
connection = api.Backend.ldap2
|
|
||||||
try:
|
try:
|
||||||
connection.delete_entry(DN(('cn', 'NTP'), ('cn', fqdn),
|
api.Backend.ldap2.delete_entry(DN(('cn', 'NTP'), ('cn', fqdn),
|
||||||
api.env.container_masters))
|
api.env.container_masters))
|
||||||
except ipalib.errors.NotFound:
|
except ipalib.errors.NotFound:
|
||||||
logger.warning("Warning: NTP service entry was not found in LDAP.")
|
logger.warning("Warning: NTP service entry was not found in LDAP.")
|
||||||
|
|
||||||
|
ntp_role_instance = servroles.ServiceBasedRole(
|
||||||
|
u"ntp_server_server",
|
||||||
|
u"NTP server",
|
||||||
|
component_services=['NTP']
|
||||||
|
)
|
||||||
|
|
||||||
|
updated_role_instances = tuple()
|
||||||
|
for role_instance in servroles.role_instances:
|
||||||
|
if role_instance is not ntp_role_instance:
|
||||||
|
updated_role_instances += tuple([role_instance])
|
||||||
|
|
||||||
|
servroles.role_instances = updated_role_instances
|
||||||
sysupgrade.set_upgrade_state('ntpd', 'ntpd_cleaned', True)
|
sysupgrade.set_upgrade_state('ntpd', 'ntpd_cleaned', True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -243,12 +243,6 @@ class config(LDAPObject):
|
|||||||
doc=_('IPA servers configured as certificate authority'),
|
doc=_('IPA servers configured as certificate authority'),
|
||||||
flags={'virtual_attribute', 'no_create', 'no_update'}
|
flags={'virtual_attribute', 'no_create', 'no_update'}
|
||||||
),
|
),
|
||||||
Str(
|
|
||||||
'ntp_server_server*',
|
|
||||||
label=_('IPA NTP servers'),
|
|
||||||
doc=_('IPA servers with enabled NTP'),
|
|
||||||
flags={'virtual_attribute', 'no_create', 'no_update'}
|
|
||||||
),
|
|
||||||
Str(
|
Str(
|
||||||
'ca_renewal_master_server?',
|
'ca_renewal_master_server?',
|
||||||
label=_('IPA CA renewal master'),
|
label=_('IPA CA renewal master'),
|
||||||
@@ -548,7 +542,7 @@ class config_mod(LDAPUpdate):
|
|||||||
|
|
||||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||||
self.obj.show_servroles_attributes(
|
self.obj.show_servroles_attributes(
|
||||||
entry_attrs, "CA server", "IPA master", "NTP server", **options)
|
entry_attrs, "CA server", "IPA master", **options)
|
||||||
return dn
|
return dn
|
||||||
|
|
||||||
|
|
||||||
@@ -558,5 +552,5 @@ class config_show(LDAPRetrieve):
|
|||||||
|
|
||||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||||
self.obj.show_servroles_attributes(
|
self.obj.show_servroles_attributes(
|
||||||
entry_attrs, "CA server", "IPA master", "NTP server", **options)
|
entry_attrs, "CA server", "IPA master", **options)
|
||||||
return dn
|
return dn
|
||||||
|
|||||||
Reference in New Issue
Block a user