Re: [PATCH 1/1] Enhance mange_dns to optionally not (re)start bind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcel Haerry wrote:
From: Marcel Haerry <haerry@xxxxxxxxx>

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.

--Michael



Signed-off-by: Marcel Haerry <haerry@xxxxxxxxx>
---
 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
--- a/cobbler/action_check.py
+++ b/cobbler/action_check.py
@@ -49,7 +49,8 @@ class BootCheck:
if self.settings.manage_dns:
            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"):
                self.check_bind_bin(status)
                self.check_service(status,"named")
            elif mode == "dnsmasq" and not self.settings.manage_dhcp:
diff --git a/config/settings b/config/settings
index 221241a..fe5c633 100644
--- a/config/settings
+++ b/config/settings
@@ -84,6 +84,12 @@ manage_dhcp: 0
 # the choice of DNS mangement engine is in /etc/cobbler/modules.conf
 manage_dns: 0
+# 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
+manage_dns_mode: local
+
 # 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
--- a/triggers/restart-services.trigger
+++ b/triggers/restart-services.trigger
@@ -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")
sys.exit(rc)

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux