diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-07 23:11:00 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-07 23:11:00 +0100 |
| commit | 4169595397ba962f230033b921964cae1629736d (patch) | |
| tree | 94e0a25a1c6b32e8b2d475ba3ab02d7ba7eaf075 /src/CLI/report.cpp | |
| parent | 8569385a9a7f679e32febafda8e8bdcfdf0fa64a (diff) | |
| parent | 2ce0dac4d05ce449f4d054c4725a852a43aab428 (diff) | |
Merge branch 'master' into rhel6
Diffstat (limited to 'src/CLI/report.cpp')
| -rw-r--r-- | src/CLI/report.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp index 2bcd52a..7ef33ac 100644 --- a/src/CLI/report.cpp +++ b/src/CLI/report.cpp @@ -412,10 +412,63 @@ int report(const char *uuid, bool always) } } + map_map_string_t pluginSettings; + if (!always) + { + // Get informations about all plugins. + map_map_string_t plugins = call_GetPluginsInfo(); + // Check the configuration of each enabled Reporter plugin. + map_map_string_t::iterator it, itend = plugins.end(); + for (it = plugins.begin(); it != itend; ++it) + { + // Skip disabled plugins. + if (0 != strcmp(it->second["Enabled"].c_str(), "yes")) + continue; + // Skip nonReporter plugins. + if (0 != strcmp(it->second["Type"].c_str(), "Reporter")) + continue; + + map_string_t settings = call_GetPluginSettings(it->first.c_str()); + // Login information is missing. + bool loginMissing = settings.find("Login") != settings.end() + && 0 == strcmp(settings["Login"].c_str(), ""); + bool passwordMissing = settings.find("Password") != settings.end() + && 0 == strcmp(settings["Password"].c_str(), ""); + if (!loginMissing && !passwordMissing) + continue; + + // Copy the received settings as defaults. + // Plugins won't work without it, if some value is missing + // they use their default values for all fields. + pluginSettings[it->first] = settings; + + printf(_("Wrong settings were detected for plugin %s.\n"), it->second["Name"].c_str()); + if (loginMissing) + { + printf(_("Enter your login: ")); + fflush(NULL); + char answer[64] = ""; + fgets(answer, sizeof(answer), stdin); + if (strlen(answer) > 0) + pluginSettings[it->first]["Login"] = answer; + } + if (passwordMissing) + { +// TODO: echo off, see http://fixunix.com/unix/84474-echo-off.html + printf(_("Enter your password: ")); + fflush(NULL); + char answer[64] = ""; + fgets(answer, sizeof(answer), stdin); + if (strlen(answer) > 0) + pluginSettings[it->first]["Password"] = answer; + } + } + } + int errors = 0; int plugins = 0; puts(_("Reporting...")); - report_status_t r = call_Report(cr); + report_status_t r = call_Report(cr, pluginSettings); report_status_t::iterator it = r.begin(); while (it != r.end()) { |
