On 08/05/2016 12:01 PM, Pavel Březina wrote:
On 07/26/2016 04:43 PM, Michal Židek wrote:
Hi!

Attached is patch for ticket:
https://fedorahosted.org/sssd/ticket/3086

This patch applies on top of the patches from
thread:
[SSSD] [PATCH] sssctl: Consistent commands naming

Michal

Hi, I believe you can use NULL instead of options.

Yes. New patch attached.

Michal

>From befa994975dee5bd34e45d068b4bcb2860330154 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzi...@redhat.com>
Date: Tue, 26 Jul 2016 16:35:55 +0200
Subject: [PATCH] sssctl: Generic help for cache-upgrade and config-check

sssctl COMMAND --help should print at least
generic help, even if the command does not
accept any command specific options.

Resolves:
https://fedorahosted.org/sssd/ticket/3086
---
 src/tools/sssctl/sssctl_config.c | 6 ++++++
 src/tools/sssctl/sssctl_data.c   | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/src/tools/sssctl/sssctl_config.c b/src/tools/sssctl/sssctl_config.c
index a66d774..630df3c 100644
--- a/src/tools/sssctl/sssctl_config.c
+++ b/src/tools/sssctl/sssctl_config.c
@@ -47,6 +47,12 @@ errno_t sssctl_config_check(struct sss_cmdline *cmdline,
     char **strs = NULL;
     TALLOC_CTX *tmp_ctx = NULL;
 
+    ret = sss_tool_popt(cmdline, NULL, SSS_TOOL_OPT_OPTIONAL, NULL, NULL);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_CRIT_FAILURE, "Unable to parse command arguments\n");
+        return ret;
+    }
+
     tmp_ctx = talloc_new(NULL);
     init_data = sss_ini_initdata_init(tmp_ctx);
     if (!init_data) {
diff --git a/src/tools/sssctl/sssctl_data.c b/src/tools/sssctl/sssctl_data.c
index a26ddd8..72823ab 100644
--- a/src/tools/sssctl/sssctl_data.c
+++ b/src/tools/sssctl/sssctl_data.c
@@ -266,6 +266,12 @@ errno_t sssctl_cache_upgrade(struct sss_cmdline *cmdline,
     struct sysdb_upgrade_ctx db_up_ctx;
     errno_t ret;
 
+    ret = sss_tool_popt(cmdline, NULL, SSS_TOOL_OPT_OPTIONAL, NULL, NULL);
+    if (ret != EOK) {
+        DEBUG(SSSDBG_CRIT_FAILURE, "Unable to parse command arguments\n");
+        return ret;
+    }
+
     if (sss_deamon_running()) {
         return ERR_SSSD_RUNNING;
     }
-- 
2.5.0

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to