URL: https://github.com/SSSD/sssd/pull/515
Author: amitkumar50
 Title: #515: sssctl: Showing help even when sssd not configured
Action: opened

PR body:
"""
Current Issue:
On a clean and unconfigured system, it's not possible
to use --help.
`# dnf install sssd-tools`
`# sssctl cache-remove --help`
Shows:
[confdb_get_domains] (0x0010): No domains configured, fatal error!

Solution: Donot check for confdb initialization when sssctl 3rd
command line argument passed is '--help'.

Please note when we run 'sssctl --help' on unconfigured system
confdb check is not done and proper o/p is seen.
Also suggest if we have better alternative..

Resolves: https://pagure.io/SSSD/sssd/issue/3634
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/515/head:pr515
git checkout pr515
From 68b27079c2b4472ed63c22e526e334a49d2fbdb9 Mon Sep 17 00:00:00 2001
From: amitkuma <amitk...@redhat.com>
Date: Thu, 15 Feb 2018 18:21:10 +0530
Subject: [PATCH] sssctl: Showing help even when sssd not configured

On a clean and unconfigured system, it's not possible
to use --help.
1) dnf install sssd-tools
2) sssctl cache-remove --help
Shows:
[confdb_get_domains] (0x0010): No domains configured, fatal error!

Solution: Donot check for confdb initialization when sssctl 3rd
command line argument passed is '--help'.

Please note when we run 'sssctl --help' on unconfigured system
confdb check is not done and proper o/p is seen.

Resolves: https://pagure.io/SSSD/sssd/issue/3634
---
 src/tools/common/sss_tools.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/tools/common/sss_tools.c b/src/tools/common/sss_tools.c
index e491a1286..bb63dc7c3 100644
--- a/src/tools/common/sss_tools.c
+++ b/src/tools/common/sss_tools.c
@@ -333,13 +333,15 @@ errno_t sss_tool_route(int argc, const char **argv,
                 return tool_ctx->init_err;
             }
 
-            ret = tool_cmd_init(tool_ctx, &commands[i]);
-            if (ret != EOK) {
-                DEBUG(SSSDBG_FATAL_FAILURE,
-                      "Command initialization failed [%d] %s\n",
-                      ret, sss_strerror(ret));
-                return ret;
-            }
+	    if(strcmp(argv[2],"--help")){
+                ret = tool_cmd_init(tool_ctx, &commands[i]);
+                if (ret != EOK) {
+                    DEBUG(SSSDBG_FATAL_FAILURE,
+                          "Command initialization failed [%d] %s\n",
+                          ret, sss_strerror(ret));
+                    return ret;
+                }
+	    }
 
             return commands[i].fn(&cmdline, tool_ctx, pvt);
         }
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to