When loading configuration fails, include the reason
authorPetr Pudlak <pudlak@google.com>
Tue, 5 Nov 2013 14:32:20 +0000 (15:32 +0100)
committerMichele Tartara <mtartara@google.com>
Wed, 6 Nov 2013 10:27:58 +0000 (10:27 +0000)
Before the message why a failure happened (like a parsing error) was lost.

Signed-off-by: Petr Pudlak <pudlak@google.com>
Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Michele Tartara <mtartara@google.com>

src/Ganeti/ConfigReader.hs

index b40c6dc..fde408b 100644 (file)
@@ -123,7 +123,8 @@ updateConfig path save_fn = do
   newcfg <- loadConfig path
   let !newdata = case newcfg of
                    Ok !cfg -> Ok cfg
-                   Bad _ -> Bad "Cannot load configuration"
+                   Bad msg -> Bad $ "Cannot load configuration from " ++ path
+                                    ++ ": " ++ msg
   save_fn newdata
   case newcfg of
     Ok cfg -> logInfo ("Loaded new config, serial " ++
@@ -329,4 +330,4 @@ initConfigReader cfg_transform ioref = do
   -- fork the polling timer
   unless has_inotify $ do
     _ <- forkIO $ onPollTimer inotiaction conf_file save_fn statemvar
-    return ()
\ No newline at end of file
+    return ()