mgmt refactoring: ManagerBase

Change-Id: I0710297f352723874d05092d091128b02b3747a2
Refs: #2107
diff --git a/core/config-file.cpp b/core/config-file.cpp
index 9724168..d989455 100644
--- a/core/config-file.cpp
+++ b/core/config-file.cpp
@@ -52,6 +52,25 @@
   // do nothing
 }
 
+bool
+ConfigFile::parseYesNo(const ConfigSection::const_iterator& i,
+                        const std::string& optionName,
+                        const std::string& sectionName)
+{
+  const std::string value = i->second.get_value<std::string>();
+  if (value == "yes") {
+    return true;
+  }
+
+  if (value == "no") {
+    return false;
+  }
+
+  BOOST_THROW_EXCEPTION(ConfigFile::Error("Invalid value for option \"" +
+                                          optionName + "\" in \"" +
+                                          sectionName + "\" section"));
+}
+
 ConfigFile::ConfigFile(UnknownConfigSectionHandler unknownSectionCallback)
   : m_unknownSectionCallback(unknownSectionCallback)
 {
diff --git a/core/config-file.hpp b/core/config-file.hpp
index 9991484..ae9102e 100644
--- a/core/config-file.hpp
+++ b/core/config-file.hpp
@@ -73,6 +73,16 @@
                        const ConfigSection& section,
                        bool isDryRun);
 
+  /** @brief parse a config option that can be either "yes" or "no"
+   *
+   *  @throw ConfigFile::Error value is neither "yes" nor "no"
+   *  @return true if "yes", false if "no"
+   */
+  static bool
+  parseYesNo(const ConfigSection::const_iterator& i,
+             const std::string& optionName,
+             const std::string& sectionName);
+
   /// \brief setup notification of configuration file sections
   void
   addSectionHandler(const std::string& sectionName,