mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-07-29 15:55:47 -05: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
@@ -29,6 +29,7 @@ from ipapython import dnsutil
|
||||
from ipapython.dn import DN
|
||||
from ipaplatform.constants import constants
|
||||
from ipaplatform.paths import paths
|
||||
from ipaserver import servroles
|
||||
from ipaserver.install import installutils
|
||||
from ipaserver.install import dsinstance
|
||||
from ipaserver.install import httpinstance
|
||||
@@ -1608,24 +1609,31 @@ def ntpd_cleanup(fqdn, fstore):
|
||||
except Exception as e:
|
||||
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 ntpd_files:
|
||||
for ntpd_file in [paths.NTP_CONF, paths.NTP_STEP_TICKERS,
|
||||
paths.SYSCONFIG_NTPD]:
|
||||
try:
|
||||
fstore.untrack_file(ntpd_file)
|
||||
os.remove(ntpd_file)
|
||||
except IOError:
|
||||
logger.warning(
|
||||
"No access to the %s, file could not be deleted.", ntpd_file)
|
||||
fstore.restore_file(ntpd_file)
|
||||
except ValueError as e:
|
||||
logger.warning("Error: %s", e)
|
||||
logger.warning(e)
|
||||
|
||||
connection = api.Backend.ldap2
|
||||
try:
|
||||
connection.delete_entry(DN(('cn', 'NTP'), ('cn', fqdn),
|
||||
api.env.container_masters))
|
||||
api.Backend.ldap2.delete_entry(DN(('cn', 'NTP'), ('cn', fqdn),
|
||||
api.env.container_masters))
|
||||
except ipalib.errors.NotFound:
|
||||
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)
|
||||
|
||||
|
||||
|
||||
@@ -243,12 +243,6 @@ class config(LDAPObject):
|
||||
doc=_('IPA servers configured as certificate authority'),
|
||||
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(
|
||||
'ca_renewal_master_server?',
|
||||
label=_('IPA CA renewal master'),
|
||||
@@ -548,7 +542,7 @@ class config_mod(LDAPUpdate):
|
||||
|
||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||
self.obj.show_servroles_attributes(
|
||||
entry_attrs, "CA server", "IPA master", "NTP server", **options)
|
||||
entry_attrs, "CA server", "IPA master", **options)
|
||||
return dn
|
||||
|
||||
|
||||
@@ -558,5 +552,5 @@ class config_show(LDAPRetrieve):
|
||||
|
||||
def post_callback(self, ldap, dn, entry_attrs, *keys, **options):
|
||||
self.obj.show_servroles_attributes(
|
||||
entry_attrs, "CA server", "IPA master", "NTP server", **options)
|
||||
entry_attrs, "CA server", "IPA master", **options)
|
||||
return dn
|
||||
|
||||
Reference in New Issue
Block a user