Enhance mange_dns to optionally not (re)start bind
Marcel Haerry wrote:
From: Marcel Haerry <email@example.com>
Use case: We'd like to manage our bind zone files by cobbler,
however on the cobbler server itself, no dhcp server should be
running as they are copied on a specific dns server.
With the following changes, you can set a settings variable
manage_dns_mode to remote, and cobbler won't anymore (re)start
bind nor check its status.
The default setting is local, which is the current behaviour. If
nothing is set, the current behaviour is respected. So it only
changes something if you set manage_dns_mode to remote.
Thanks very much for the patch. It turns out that the way this patch
is implemented exposes something I need to fix in cobbler -- namely,
manage_dhcp_mode and manage_dns_mode are no longer used. Instead,
these modes are governed by modules.conf.
So what we need to do is make this trigger access the modules system and
call the restart functions in those modules systems, and add two new
settings to the config file to govern whether or not DNS and DHCP
(respectively) are managed locally, and we add those to the trigger.
Apologies for the confusion, these two settings in the code are dead and
I need to pull them out. I'll do that now so I can apply what your
patch does as well as make something workable for 1.0.3.
Signed-off-by: Marcel Haerry <firstname.lastname@example.org>
cobbler/action_check.py | 3 ++-
config/settings | 6 ++++++
triggers/restart-services.trigger | 3 ++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/cobbler/action_check.py b/cobbler/action_check.py
index 3f7c8fc..03cde91 100644
@@ -49,7 +49,8 @@ class BootCheck:
mode = self.config.api.get_sync().dns.what()
- if mode == "bind":
+ mode_dns = self.settings.manage_dns_mode
+ if (mode == "bind") and (mode_dns != "remote"):
elif mode == "dnsmasq" and not self.settings.manage_dhcp:
diff --git a/config/settings b/config/settings
index 221241a..fe5c633 100644
@@ -84,6 +84,12 @@ manage_dhcp: 0
# the choice of DNS mangement engine is in /etc/cobbler/modules.conf
+# set to remote to disable named (re)starting.
+# This option can be interesting if you'd like to manage dns zone files
+# by cobbler but aren't running named on the cobbler server itself.
+# Values: local, remote
# if using BIND (named) for DNS management in /etc/cobbler/modules.conf
# and manage_dns is enabled (above), this lists which zones are managed
# See the Wiki (https://fedorahosted.org/cobbler/wiki/ManageDns) for more info
diff --git a/triggers/restart-services.trigger b/triggers/restart-services.trigger
index d586f46..7b04efc 100644
@@ -11,6 +11,7 @@ settings = bootapi.settings()
manage_dhcp = str(settings.manage_dhcp).lower()
manage_dhcp_mode = str(settings.manage_dhcp_mode).lower()
manage_dns = str(settings.manage_dns).lower()
+manage_dns_mode = str(settings.manage_dns_mode).lower()
omapi_enabled = settings.omapi_enabled
omapi_port = settings.omapi_port
@@ -25,7 +26,7 @@ if manage_dhcp != "0":
print "- error: unknown DHCP engine: %s" % manage_dhcp_mode
rc = 411
-if manage_dns != "0":
+if (manage_dns != "0") and (manage_dns_mode != "remote"):
rc = os.system("/sbin/service named restart")
et-mgmt-tools mailing list