Adding forceCfg example to config-dist.json
authorFrederic Massart <fred@moodle.com>
Wed, 5 Nov 2014 03:38:10 +0000 (11:38 +0800)
committerFrederic Massart <fred@moodle.com>
Wed, 5 Nov 2014 03:38:10 +0000 (11:38 +0800)
mdk/config-dist.json
mdk/moodle.py

index 1b8d97b..b419086 100644 (file)
     // What to call the upstream remote, the one pointing to the official repositoriy (stable or integration)
     "upstreamRemote": "origin",
 
+    // Config setting that should be set in config.php when an instance is being installed.
+    "forceCfg": {
+        // The following example will set CFG->divertallemailsto to "root@localhost.local".
+        // "divertallemailsto": "root@localhost.local"
+    },
+
     // Behat related settings
     "behat": {
 
index 7973cb0..86c8356 100644 (file)
@@ -418,18 +418,18 @@ class Moodle(object):
                 self.addConfig('sessioncookiepath', '/%s/%s/' % (C.get('path'), self.identifier))
             else:
                 self.addConfig('sessioncookiepath', '/%s/' % self.identifier)
-        except InstallException:
+        except Exception:
             logging.warning('Could not append $CFG->sessioncookiepath to config.php')
 
-        # Add forced $CFG to the config.php if some are globally defined
+        # Add forced $CFG to the config.php if some are globally defined.
         forceCfg = C.get('forceCfg')
         if isinstance(forceCfg, dict):
-            logging.info('Setting up forced $CFG variables in the config.php ...')
             for cfgKey, cfgValue in forceCfg.iteritems():
                 try:
+                    logging.info('Setting up forced $CFG->%s to \'%s\' in config.php', cfgKey, cfgValue)
                     self.addConfig(cfgKey, cfgValue)
-                except InstallException:
-                    logging.warning('Could not append $CFG->%s to config.php' % cfgKey)
+                except Exception:
+                    logging.warning('Could not append $CFG->%s to config.php', cfgKey)
 
         self.reload()