]> git.ipfire.org Git - ddns.git/blobdiff - src/ddns/__init__.py
Add runtime check for providers if all dependencies are met
[ddns.git] / src / ddns / __init__.py
index fbebc0ef0ad9a91aade2dfd208bc516000c333c0..7f2729c2c8c0cc93e09e46ec343fce6804664276 100644 (file)
@@ -28,6 +28,7 @@ from i18n import _
 logger = logging.getLogger("ddns.core")
 logger.propagate = 1
 
+import database
 import providers
 
 from .errors import *
@@ -76,6 +77,9 @@ class DDNSCore(object):
                # Add the system class.
                self.system = DDNSSystem(self)
 
+               # Open the database.
+               self.db = database.DDNSDatabase(self, "/var/lib/ddns.db")
+
        def get_provider_names(self):
                """
                        Returns a list of names of all registered providers.
@@ -120,6 +124,12 @@ class DDNSCore(object):
                                logger.warning("Could not find provider '%s' for entry '%s'." % (provider, entry))
                                continue
 
+                       # Check if the provider is actually supported and if there are
+                       # some dependencies missing on this system.
+                       if not provider.supported():
+                               logger.warning("Provider '%s' is known, but not supported on this machine" % (provider.name))
+                               continue
+
                        # Create an instance of the provider object with settings from the
                        # configuration file.
                        entry = provider(self, **settings)