]> git.llucax.com Git - software/pymin.git/blobdiff - pymin/services/dns/__init__.py
qos template fixes
[software/pymin.git] / pymin / services / dns / __init__.py
index d34291e66c18c7270bf2b9dcc8271e111a9c3059..9324afbba3006c73e3031e9329d22c05d5d2c6a8 100644 (file)
@@ -109,13 +109,7 @@ class DnsHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler,
         self._config_writer_cfg_dir = config_dir
         self._update = False
         self._config_build_templates()
-        self._restore()
-        # FIXME self._update = True
-        #if not self._restore():
-        #r = self._restore()
-        #print r
-        #if not r:
-        #    self._update = True
+        InitdHandler.__init__(self)
         self.host = HostHandler(self)
         self.zone = ZoneHandler(self)
         self.mx = MailExchangeHandler(self)
@@ -132,7 +126,7 @@ class DnsHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler,
         delete_zones = list()
         for a_zone in self.zones.values():
             if a_zone._update or a_zone._add:
-                if not a_zone._add:
+                if not a_zone._add and self._service_running:
                     call(('rndc', 'freeze', a_zone.name))
                 vars = dict(
                     zone = a_zone,
@@ -143,7 +137,7 @@ class DnsHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler,
                 self._write_single_config('zoneX.zone',
                                             self._zone_filename(a_zone), vars)
                 a_zone._update = False
-                if not a_zone._add:
+                if not a_zone._add and self._service_running:
                     call(('rndc', 'thaw', a_zone.name))
                 else :
                     self._update = True
@@ -165,7 +159,20 @@ class DnsHandler(Restorable, ConfigWriter, InitdHandler, TransactionalHandler,
         if self._update:
             self._write_single_config('named.conf')
             self._update = False
-            self.reload()
+            return False # Do reload
+        return True # we don't need to reload
+
+    # HACK!!!!
+    def handle_timer(self):
+        import subprocess
+        p = subprocess.Popen(('pgrep', '-f', '/usr/sbin/named'),
+                                stdout=subprocess.PIPE)
+        pid = p.communicate()[0]
+        if p.returncode == 0 and len(pid) > 0:
+            self._service_running = True
+        else:
+            self._service_running = False
+
 
 
 if __name__ == '__main__':