std::list<std::string> failed_modules;
- std::set<std::string> module_names = probe_modules();
+ const std::string module_path = g_conf().get_val<std::string>("mgr_module_path");
+ std::set<std::string> module_names = probe_modules(module_path);
// Load python code
for (const auto& module_name : module_names) {
dout(1) << "Loading python module '" << module_name << "'" << dendl;
// report its loading error
modules[module_name] = std::move(mod);
}
-
+ if (module_names.empty()) {
+ clog->error() << "No ceph-mgr modules found in " << module_path;
+ }
if (!failed_modules.empty()) {
clog->error() << "Failed to load ceph-mgr modules: " << joinify(
failed_modules.begin(), failed_modules.end(), std::string(", "));
Py_Finalize();
}
-std::set<std::string> PyModuleRegistry::probe_modules() const
+std::set<std::string> PyModuleRegistry::probe_modules(const std::string &path) const
{
- std::string path = g_conf().get_val<std::string>("mgr_module_path");
-
DIR *dir = opendir(path.c_str());
if (!dir) {
return {};