Blob Blame History Raw
From a0999c19479d7362cea830ff43926e5a08b26c3f Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Mon, 8 Aug 2011 16:45:45 +0200
Subject: [PATCH 32/52] reporter-rhtsupport: make -c CONFFILE to have a
 default

This helps to make report tool users to have a way to specify
login/password in a reasonably non-awkward way.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
 src/plugins/Makefile.am           |    3 ++-
 src/plugins/reporter-rhtsupport.c |    7 +++++--
 src/plugins/rhtsupport.conf       |   13 +++++++++++++
 4 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 src/plugins/rhtsupport.conf

--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -16,7 +16,8 @@ pluginsconfdir = $(PLUGINS_CONF_DIR)
 reportpluginsconfdir = $(REPORT_PLUGINS_CONF_DIR)

 dist_reportpluginsconf_DATA = \
-    Bugzilla.conf
+    Bugzilla.conf \
+    rhtsupport.conf

 eventsdir = $(EVENTS_DIR)

diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 851665e..9ae2b45 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -368,7 +368,8 @@ int main(int argc, char **argv)
         "\n"
         "Reports a problem to RHTSupport.\n"
         "\n"
-        "CONFFILE lines should have 'PARAM = VALUE' format.\n"
+        "If not specified, CONFFILE defaults to "CONF_DIR"/plugins/rhtsupport.conf\n"
+        "Its lines should have 'PARAM = VALUE' format.\n"
         "Recognized string parameters: URL, Login, Password.\n"
         "Recognized boolean parameter (VALUE should be 1/0, yes/no): SSLVerify.\n"
         "Parameters can be overridden via $RHTSupport_PARAM environment variables.\n"
@@ -400,9 +401,11 @@ int main(int argc, char **argv)

     /* Parse config, extract necessary params */
     map_string_h *settings = new_map_string();
+    if (!conf_file)
+        conf_file = g_list_append(conf_file, (char*) CONF_DIR"/plugins/rhtsupport.conf");
     while (conf_file)
     {
-        char *fn = (char *)conf_file->data;
+        const char *fn = (char *)conf_file->data;
         VERB1 log("Loading settings from '%s'", fn);
         load_conf_file(fn, settings, /*skip key w/o values:*/ true);
         VERB3 log("Loaded '%s'", fn);
diff --git a/src/plugins/rhtsupport.conf b/src/plugins/rhtsupport.conf
new file mode 100644
index 0000000..af3cde8
--- /dev/null
+++ b/src/plugins/rhtsupport.conf
@@ -0,0 +1,13 @@
+# Uncomment and specify these parameters if you want to use
+# reporter-rhtsupport and/or "report --target strata" tools
+# outside of libreport's GUI (i.e. from command line
+# or in custom scripts) and you don't want to specify,
+# for example, login name in every tool invocation.
+#
+# String parameters:
+# URL=
+# Login=
+# Password=
+#
+# Boolean parameter:
+# SSLVerify=
--
1.7.6