From 1997733cdf60bbd5fee8a5286d567580fa4e0198 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Jun 17 2016 16:05:03 +0000 Subject: DNS Locations: require to restart named-pkcs11 affter location change Send a warning message that named-pkcs11 service must be restarted after changes related to locations or server weight https://fedorahosted.org/freeipa/ticket/2008 Reviewed-By: Petr Spacek --- diff --git a/ipalib/messages.py b/ipalib/messages.py index cae9d78..0f1dc63 100644 --- a/ipalib/messages.py +++ b/ipalib/messages.py @@ -428,6 +428,15 @@ class AutomaticDNSRecordsUpdateFailed(PublicMessage): ) +class ServiceRestartRequired(PublicMessage): + errno = 13025 + type = "warning" + format = _( + "Service %(service)s requires restart on IPA server %(server)s to " + "apply configuration changes." + ) + + def iter_messages(variables, base): """Return a tuple with all subclasses """ diff --git a/ipaserver/plugins/server.py b/ipaserver/plugins/server.py index a39d268..956e7e5 100644 --- a/ipaserver/plugins/server.py +++ b/ipaserver/plugins/server.py @@ -18,6 +18,7 @@ from .baseldap import ( from ipalib.request import context from ipalib import _, ngettext from ipalib import output +from ipaplatform import services from ipapython.dn import DN from ipapython.dnsutil import DNSName from ipaserver.servroles import ENABLED @@ -252,7 +253,11 @@ class server_mod(LDAPUpdate): # server is not DNS server pass - if 'ipalocation' or 'ipalocationweight' in entry_attrs: + if 'ipalocation_location' or 'ipalocationweight' in options: + self.add_message(messages.ServiceRestartRequired( + service=services.service('named').systemd_name, + server=keys[0], )) + result = self.api.Command.dns_update_system_records() if not result.get('value'): self.add_message(messages.AutomaticDNSRecordsUpdateFailed())