Browse Source

[2013] narrowed a try block so exception-free part is outside of the block.

JINMEI Tatuya 13 years ago
parent
commit
3e0f47f739
1 changed files with 7 additions and 8 deletions
  1. 7 8
      src/bin/ddns/ddns.py.in

+ 7 - 8
src/bin/ddns/ddns.py.in

@@ -128,15 +128,14 @@ def get_datasrc_client(cc_session):
     function will simply be removed.
 
     '''
+    HARDCODED_DATASRC_CLASS = RRClass.IN()
+    file, is_default = cc_session.get_remote_config_value("Auth",
+                                                          "database_file")
+    # See xfrout.py:get_db_file() for this trick:
+    if is_default and "B10_FROM_BUILD" in os.environ:
+        file = os.environ["B10_FROM_BUILD"] + "/bind10_zones.sqlite3"
+    datasrc_config = '{ "database_file": "' + file + '"}'
     try:
-        HARDCODED_DATASRC_CLASS = RRClass.IN()
-        file, is_default = cc_session.get_remote_config_value("Auth",
-                                                              "database_file")
-        # See xfrout.py:get_db_file() for this trick:
-        if is_default and "B10_FROM_BUILD" in os.environ:
-            file = os.environ["B10_FROM_BUILD"] + "/bind10_zones.sqlite3"
-
-        datasrc_config = '{ "database_file": "' + file + '"}'
         return HARDCODED_DATASRC_CLASS, DataSourceClient('sqlite3',
                                                          datasrc_config)
     except isc.datasrc.Error as ex: