dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0066-sssctl-Consistent-commands-naming.patch

b2d430
From 6f36e763802e35ff2c431e67be20664e221de85f Mon Sep 17 00:00:00 2001
b2d430
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
b2d430
Date: Mon, 25 Jul 2016 13:50:13 +0200
b2d430
Subject: [PATCH 66/74] sssctl: Consistent commands naming
b2d430
MIME-Version: 1.0
b2d430
Content-Type: text/plain; charset=UTF-8
b2d430
Content-Transfer-Encoding: 8bit
b2d430
b2d430
Use TOPIC-ACTION pattern for sssctl command
b2d430
names.
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/3087
b2d430
b2d430
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
b2d430
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
b2d430
---
b2d430
 src/tools/common/sss_tools.h      |  2 ++
b2d430
 src/tools/sss_override.c          | 26 +++++++++++------------
b2d430
 src/tools/sssctl/sssctl.c         | 22 ++++++++++----------
b2d430
 src/tools/sssctl/sssctl.h         | 43 +++++++++++++++++++--------------------
b2d430
 src/tools/sssctl/sssctl_cache.c   | 18 ++++++++--------
b2d430
 src/tools/sssctl/sssctl_data.c    | 16 +++++++--------
b2d430
 src/tools/sssctl/sssctl_domains.c |  6 +++---
b2d430
 src/tools/sssctl/sssctl_logs.c    |  4 ++--
b2d430
 8 files changed, 69 insertions(+), 68 deletions(-)
b2d430
b2d430
diff --git a/src/tools/common/sss_tools.h b/src/tools/common/sss_tools.h
b2d430
index a9ebabe21df14eba52f348046c179a91a6394b97..41c8b10e8c2dd8d6a86297b42a71dd5aaf9e556a 100644
b2d430
--- a/src/tools/common/sss_tools.h
b2d430
+++ b/src/tools/common/sss_tools.h
b2d430
@@ -46,7 +46,9 @@ typedef errno_t
b2d430
                 void *pvt);
b2d430
 
b2d430
 #define SSS_TOOL_COMMAND(cmd, msg, err, fn) {cmd, _(msg), err, fn}
b2d430
+#define SSS_TOOL_COMMAND_NOMSG(cmd, err, fn) {cmd, NULL, err, fn}
b2d430
 #define SSS_TOOL_DELIMITER(message) {"", (message), 0, NULL}
b2d430
+#define SSS_TOOL_LAST {NULL, NULL, 0, NULL}
b2d430
 
b2d430
 struct sss_route_cmd {
b2d430
     const char *command;
b2d430
diff --git a/src/tools/sss_override.c b/src/tools/sss_override.c
b2d430
index 45a28fd7f5366cd85e6ecd13a4846917d18e9613..d41da52e69acdb67b5a6d624254e3b89a8aa27b8 100644
b2d430
--- a/src/tools/sss_override.c
b2d430
+++ b/src/tools/sss_override.c
b2d430
@@ -1913,19 +1913,19 @@ static int override_group_export(struct sss_cmdline *cmdline,
b2d430
 int main(int argc, const char **argv)
b2d430
 {
b2d430
     struct sss_route_cmd commands[] = {
b2d430
-        {"user-add", NULL, 0, override_user_add},
b2d430
-        {"user-del", NULL, 0, override_user_del},
b2d430
-        {"user-find", NULL, 0, override_user_find},
b2d430
-        {"user-show", NULL, 0, override_user_show},
b2d430
-        {"user-import", NULL, 0, override_user_import},
b2d430
-        {"user-export", NULL, 0, override_user_export},
b2d430
-        {"group-add", NULL, 0, override_group_add},
b2d430
-        {"group-del", NULL, 0, override_group_del},
b2d430
-        {"group-find", NULL, 0, override_group_find},
b2d430
-        {"group-show", NULL, 0, override_group_show},
b2d430
-        {"group-import", NULL, 0, override_group_import},
b2d430
-        {"group-export", NULL, 0, override_group_export},
b2d430
-        {NULL, NULL, 0, NULL}
b2d430
+        SSS_TOOL_COMMAND_NOMSG("user-add", 0, override_user_add),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("user-del", 0, override_user_del),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("user-find", 0, override_user_find),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("user-show", 0, override_user_show),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("user-import", 0, override_user_import),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("user-export", 0, override_user_export),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("group-add", 0, override_group_add),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("group-del", 0, override_group_del),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("group-find", 0, override_group_find),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("group-show", 0, override_group_show),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("group-import", 0, override_group_import),
b2d430
+        SSS_TOOL_COMMAND_NOMSG("group-export", 0, override_group_export),
b2d430
+        SSS_TOOL_LAST
b2d430
     };
b2d430
 
b2d430
     return sss_tool_main(argc, argv, commands, NULL);
b2d430
diff --git a/src/tools/sssctl/sssctl.c b/src/tools/sssctl/sssctl.c
b2d430
index 86656f136c00234a230b8fc779a0d245f0d125d5..20ea26f8f71c26a925f5c37327635e346f497891 100644
b2d430
--- a/src/tools/sssctl/sssctl.c
b2d430
+++ b/src/tools/sssctl/sssctl.c
b2d430
@@ -257,25 +257,25 @@ int main(int argc, const char **argv)
b2d430
 {
b2d430
     struct sss_route_cmd commands[] = {
b2d430
         SSS_TOOL_DELIMITER("SSSD Status:"),
b2d430
-        SSS_TOOL_COMMAND("list-domains", "List available domains", 0, sssctl_list_domains),
b2d430
+        SSS_TOOL_COMMAND("domain-list", "List available domains", 0, sssctl_domain_list),
b2d430
         SSS_TOOL_COMMAND("domain-status", "Print information about domain", 0, sssctl_domain_status),
b2d430
         SSS_TOOL_DELIMITER("Information about cached content:"),
b2d430
-        SSS_TOOL_COMMAND("user", "Information about cached user", 0, sssctl_user),
b2d430
-        SSS_TOOL_COMMAND("group", "Information about cached group", 0, sssctl_group),
b2d430
-        SSS_TOOL_COMMAND("netgroup", "Information about cached netgroup", 0, sssctl_netgroup),
b2d430
+        SSS_TOOL_COMMAND("user-show", "Information about cached user", 0, sssctl_user_show),
b2d430
+        SSS_TOOL_COMMAND("group-show", "Information about cached group", 0, sssctl_group_show),
b2d430
+        SSS_TOOL_COMMAND("netgroup-show", "Information about cached netgroup", 0, sssctl_netgroup_show),
b2d430
         SSS_TOOL_DELIMITER("Local data tools:"),
b2d430
-        SSS_TOOL_COMMAND("backup-local-data", "Backup local data", 0, sssctl_backup_local_data),
b2d430
-        SSS_TOOL_COMMAND("restore-local-data", "Restore local data from backup", 0, sssctl_restore_local_data),
b2d430
-        SSS_TOOL_COMMAND("remove-cache", "Backup local data and remove cached content", 0, sssctl_remove_cache),
b2d430
-        SSS_TOOL_COMMAND("upgrade-cache", "Perform cache upgrade", ERR_SYSDB_VERSION_TOO_OLD, sssctl_upgrade_cache),
b2d430
+        SSS_TOOL_COMMAND("client-data-backup", "Backup local data", 0, sssctl_client_data_backup),
b2d430
+        SSS_TOOL_COMMAND("client-data-restore", "Restore local data from backup", 0, sssctl_client_data_restore),
b2d430
+        SSS_TOOL_COMMAND("cache-remove", "Backup local data and remove cached content", 0, sssctl_cache_remove),
b2d430
+        SSS_TOOL_COMMAND("cache-upgrade", "Perform cache upgrade", ERR_SYSDB_VERSION_TOO_OLD, sssctl_cache_upgrade),
b2d430
         SSS_TOOL_DELIMITER("Log files tools:"),
b2d430
-        SSS_TOOL_COMMAND("remove-logs", "Remove existing SSSD log files", 0, sssctl_remove_logs),
b2d430
-        SSS_TOOL_COMMAND("fetch-logs", "Archive SSSD log files in tarball", 0, sssctl_fetch_logs),
b2d430
+        SSS_TOOL_COMMAND("logs-remove", "Remove existing SSSD log files", 0, sssctl_logs_remove),
b2d430
+        SSS_TOOL_COMMAND("logs-fetch", "Archive SSSD log files in tarball", 0, sssctl_logs_fetch),
b2d430
 #ifdef HAVE_LIBINI_CONFIG_V1_3
b2d430
         SSS_TOOL_DELIMITER("Configuration files tools:"),
b2d430
         SSS_TOOL_COMMAND("config-check", "Perform static analysis of SSSD configuration", 0, sssctl_config_check),
b2d430
 #endif
b2d430
-        {NULL, NULL, 0, NULL}
b2d430
+        SSS_TOOL_LAST
b2d430
     };
b2d430
 
b2d430
     return sss_tool_main(argc, argv, commands, NULL);
b2d430
diff --git a/src/tools/sssctl/sssctl.h b/src/tools/sssctl/sssctl.h
b2d430
index be624755de531df9ff5a97f5640266801695ef6e..72930ee5c3a1195e90c6e35768f715cbf6a1c4e1 100644
b2d430
--- a/src/tools/sssctl/sssctl.h
b2d430
+++ b/src/tools/sssctl/sssctl.h
b2d430
@@ -56,52 +56,51 @@ void _sssctl_sifp_error(sss_sifp_ctx *sifp,
b2d430
 #define sssctl_sifp_error(sifp, error, message) \
b2d430
     _sssctl_sifp_error(sifp, error, _(message))
b2d430
 
b2d430
-errno_t sssctl_list_domains(struct sss_cmdline *cmdline,
b2d430
-                            struct sss_tool_ctx *tool_ctx,
b2d430
-                            void *pvt);
b2d430
+errno_t sssctl_domain_list(struct sss_cmdline *cmdline,
b2d430
+                           struct sss_tool_ctx *tool_ctx,
b2d430
+                           void *pvt);
b2d430
 
b2d430
 errno_t sssctl_domain_status(struct sss_cmdline *cmdline,
b2d430
                              struct sss_tool_ctx *tool_ctx,
b2d430
                              void *pvt);
b2d430
 
b2d430
-errno_t sssctl_backup_local_data(struct sss_cmdline *cmdline,
b2d430
-                                 struct sss_tool_ctx *tool_ctx,
b2d430
-                                 void *pvt);
b2d430
-
b2d430
-errno_t sssctl_restore_local_data(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_client_data_backup(struct sss_cmdline *cmdline,
b2d430
                                   struct sss_tool_ctx *tool_ctx,
b2d430
                                   void *pvt);
b2d430
 
b2d430
-errno_t sssctl_remove_cache(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_client_data_restore(struct sss_cmdline *cmdline,
b2d430
+                                   struct sss_tool_ctx *tool_ctx,
b2d430
+                                   void *pvt);
b2d430
+
b2d430
+errno_t sssctl_cache_remove(struct sss_cmdline *cmdline,
b2d430
                             struct sss_tool_ctx *tool_ctx,
b2d430
                             void *pvt);
b2d430
 
b2d430
-errno_t sssctl_upgrade_cache(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_cache_upgrade(struct sss_cmdline *cmdline,
b2d430
                              struct sss_tool_ctx *tool_ctx,
b2d430
                              void *pvt);
b2d430
 
b2d430
-errno_t sssctl_remove_logs(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_logs_remove(struct sss_cmdline *cmdline,
b2d430
                            struct sss_tool_ctx *tool_ctx,
b2d430
                            void *pvt);
b2d430
 
b2d430
-errno_t sssctl_fetch_logs(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_logs_fetch(struct sss_cmdline *cmdline,
b2d430
                           struct sss_tool_ctx *tool_ctx,
b2d430
                           void *pvt);
b2d430
 
b2d430
-errno_t sssctl_user(struct sss_cmdline *cmdline,
b2d430
-                    struct sss_tool_ctx *tool_ctx,
b2d430
-                    void *pvt);
b2d430
+errno_t sssctl_user_show(struct sss_cmdline *cmdline,
b2d430
+                         struct sss_tool_ctx *tool_ctx,
b2d430
+                         void *pvt);
b2d430
 
b2d430
-errno_t sssctl_group(struct sss_cmdline *cmdline,
b2d430
-                     struct sss_tool_ctx *tool_ctx,
b2d430
-                     void *pvt);
b2d430
+errno_t sssctl_group_show(struct sss_cmdline *cmdline,
b2d430
+                          struct sss_tool_ctx *tool_ctx,
b2d430
+                          void *pvt);
b2d430
 
b2d430
-errno_t sssctl_netgroup(struct sss_cmdline *cmdline,
b2d430
-                        struct sss_tool_ctx *tool_ctx,
b2d430
-                        void *pvt);
b2d430
+errno_t sssctl_netgroup_show(struct sss_cmdline *cmdline,
b2d430
+                             struct sss_tool_ctx *tool_ctx,
b2d430
+                             void *pvt);
b2d430
 
b2d430
 errno_t sssctl_config_check(struct sss_cmdline *cmdline,
b2d430
                             struct sss_tool_ctx *tool_ctx,
b2d430
                             void *pvt);
b2d430
-
b2d430
 #endif /* _SSSCTL_H_ */
b2d430
diff --git a/src/tools/sssctl/sssctl_cache.c b/src/tools/sssctl/sssctl_cache.c
b2d430
index 4a1f3558ed7064ca40ccf9313d99fbab36e6e4c9..b1a7cc933d58d99fe34a05cb6eabe11a5270cee1 100644
b2d430
--- a/src/tools/sssctl/sssctl_cache.c
b2d430
+++ b/src/tools/sssctl/sssctl_cache.c
b2d430
@@ -569,9 +569,9 @@ struct sssctl_cache_opts {
b2d430
     int id;
b2d430
 };
b2d430
 
b2d430
-errno_t sssctl_user(struct sss_cmdline *cmdline,
b2d430
-                    struct sss_tool_ctx *tool_ctx,
b2d430
-                    void *pvt)
b2d430
+errno_t sssctl_user_show(struct sss_cmdline *cmdline,
b2d430
+                         struct sss_tool_ctx *tool_ctx,
b2d430
+                         void *pvt)
b2d430
 {
b2d430
     struct sssctl_cache_opts opts = {0};
b2d430
     const char *attr;
b2d430
@@ -616,9 +616,9 @@ errno_t sssctl_user(struct sss_cmdline *cmdline,
b2d430
     return EOK;
b2d430
 }
b2d430
 
b2d430
-errno_t sssctl_group(struct sss_cmdline *cmdline,
b2d430
-                     struct sss_tool_ctx *tool_ctx,
b2d430
-                     void *pvt)
b2d430
+errno_t sssctl_group_show(struct sss_cmdline *cmdline,
b2d430
+                          struct sss_tool_ctx *tool_ctx,
b2d430
+                          void *pvt)
b2d430
 {
b2d430
     struct sssctl_cache_opts opts = {0};
b2d430
     const char *attr;
b2d430
@@ -662,9 +662,9 @@ errno_t sssctl_group(struct sss_cmdline *cmdline,
b2d430
     return EOK;
b2d430
 }
b2d430
 
b2d430
-errno_t sssctl_netgroup(struct sss_cmdline *cmdline,
b2d430
-                        struct sss_tool_ctx *tool_ctx,
b2d430
-                        void *pvt)
b2d430
+errno_t sssctl_netgroup_show(struct sss_cmdline *cmdline,
b2d430
+                             struct sss_tool_ctx *tool_ctx,
b2d430
+                             void *pvt)
b2d430
 {
b2d430
     struct sssctl_cache_opts opts = {0};
b2d430
     errno_t ret;
b2d430
diff --git a/src/tools/sssctl/sssctl_data.c b/src/tools/sssctl/sssctl_data.c
b2d430
index 3ab2ddf20006b2d5a26e2f167819677431854eb6..a26ddd8d5200319e75282b738791cf270f0d75a8 100644
b2d430
--- a/src/tools/sssctl/sssctl_data.c
b2d430
+++ b/src/tools/sssctl/sssctl_data.c
b2d430
@@ -124,9 +124,9 @@ static errno_t sssctl_backup(bool force)
b2d430
     return ret;
b2d430
 }
b2d430
 
b2d430
-errno_t sssctl_backup_local_data(struct sss_cmdline *cmdline,
b2d430
-                                 struct sss_tool_ctx *tool_ctx,
b2d430
-                                 void *pvt)
b2d430
+errno_t sssctl_client_data_backup(struct sss_cmdline *cmdline,
b2d430
+                                  struct sss_tool_ctx *tool_ctx,
b2d430
+                                  void *pvt)
b2d430
 {
b2d430
     struct sssctl_data_opts opts = {0};
b2d430
     errno_t ret;
b2d430
@@ -184,9 +184,9 @@ static errno_t sssctl_restore(bool force_start, bool force_restart)
b2d430
     return ret;
b2d430
 }
b2d430
 
b2d430
-errno_t sssctl_restore_local_data(struct sss_cmdline *cmdline,
b2d430
-                                  struct sss_tool_ctx *tool_ctx,
b2d430
-                                  void *pvt)
b2d430
+errno_t sssctl_client_data_restore(struct sss_cmdline *cmdline,
b2d430
+                                   struct sss_tool_ctx *tool_ctx,
b2d430
+                                   void *pvt)
b2d430
 {
b2d430
     struct sssctl_data_opts opts = {0};
b2d430
     errno_t ret;
b2d430
@@ -207,7 +207,7 @@ errno_t sssctl_restore_local_data(struct sss_cmdline *cmdline,
b2d430
     return sssctl_restore(opts.start, opts.restart);
b2d430
 }
b2d430
 
b2d430
-errno_t sssctl_remove_cache(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_cache_remove(struct sss_cmdline *cmdline,
b2d430
                             struct sss_tool_ctx *tool_ctx,
b2d430
                             void *pvt)
b2d430
 {
b2d430
@@ -259,7 +259,7 @@ errno_t sssctl_remove_cache(struct sss_cmdline *cmdline,
b2d430
     return EOK;
b2d430
 }
b2d430
 
b2d430
-errno_t sssctl_upgrade_cache(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_cache_upgrade(struct sss_cmdline *cmdline,
b2d430
                              struct sss_tool_ctx *tool_ctx,
b2d430
                              void *pvt)
b2d430
 {
b2d430
diff --git a/src/tools/sssctl/sssctl_domains.c b/src/tools/sssctl/sssctl_domains.c
b2d430
index 5aaaf770981a92b80b9376fd244d2d97e0502dac..cfc4e56133213e27496350033d4d28c3f5b5c63d 100644
b2d430
--- a/src/tools/sssctl/sssctl_domains.c
b2d430
+++ b/src/tools/sssctl/sssctl_domains.c
b2d430
@@ -27,9 +27,9 @@
b2d430
 #include "sbus/sssd_dbus.h"
b2d430
 #include "responder/ifp/ifp_iface.h"
b2d430
 
b2d430
-errno_t sssctl_list_domains(struct sss_cmdline *cmdline,
b2d430
-                            struct sss_tool_ctx *tool_ctx,
b2d430
-                            void *pvt)
b2d430
+errno_t sssctl_domain_list(struct sss_cmdline *cmdline,
b2d430
+                           struct sss_tool_ctx *tool_ctx,
b2d430
+                           void *pvt)
b2d430
 {
b2d430
     sss_sifp_ctx *sifp;
b2d430
     sss_sifp_error error;
b2d430
diff --git a/src/tools/sssctl/sssctl_logs.c b/src/tools/sssctl/sssctl_logs.c
b2d430
index a203474648e3c1719e16146f8f7b484f9d62541c..883f2ac2fa688b672cd8f388e4c571d1a12a32af 100644
b2d430
--- a/src/tools/sssctl/sssctl_logs.c
b2d430
+++ b/src/tools/sssctl/sssctl_logs.c
b2d430
@@ -34,7 +34,7 @@ struct sssctl_logs_opts {
b2d430
     int archived;
b2d430
 };
b2d430
 
b2d430
-errno_t sssctl_remove_logs(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_logs_remove(struct sss_cmdline *cmdline,
b2d430
                            struct sss_tool_ctx *tool_ctx,
b2d430
                            void *pvt)
b2d430
 {
b2d430
@@ -74,7 +74,7 @@ errno_t sssctl_remove_logs(struct sss_cmdline *cmdline,
b2d430
     return EOK;
b2d430
 }
b2d430
 
b2d430
-errno_t sssctl_fetch_logs(struct sss_cmdline *cmdline,
b2d430
+errno_t sssctl_logs_fetch(struct sss_cmdline *cmdline,
b2d430
                           struct sss_tool_ctx *tool_ctx,
b2d430
                           void *pvt)
b2d430
 {
b2d430
-- 
b2d430
2.4.11
b2d430