From c62d23d75ca906beb3a24b4a24c9e4ef828a8b34 Mon Sep 17 00:00:00 2001
From: Michael Davis <michael.davis@cern.ch>
Date: Thu, 5 Apr 2018 18:07:42 +0200
Subject: [PATCH] [cta-catalogue-admin] Makes command line options consistent
 with cta-admin ad/ah

Now use -m for comments not -c.

Also fixes some typos.
---
 catalogue/CreateAdminHostCmdLineArgs.cpp             | 12 ++++++------
 catalogue/CreateAdminHostCmdLineArgsTest.cpp         |  2 +-
 catalogue/CreateAdminUserCmdLineArgs.cpp             | 12 ++++++------
 catalogue/CreateAdminUserCmdLineArgsTest.cpp         |  2 +-
 catalogue/CreateSchemaCmdLineArgs.cpp                |  2 +-
 catalogue/DropSchemaCmdLineArgs.cpp                  |  2 +-
 catalogue/PollDatabaseCmdLineArgs.cpp                |  2 +-
 catalogue/cta-catalogue-admin-host-create.1cta       |  4 ++--
 catalogue/cta-catalogue-admin-user-create.1cta       |  4 ++--
 .../orchestration/tests/prepare_tests.sh             |  6 +++---
 continuousintegration/orchestration/tests/systest.sh |  4 ++--
 .../tests/systest_xrdcp_many_concurrent_files.sh     |  4 ++--
 .../orchestration/tests/systest_xrdcp_many_files.sh  |  4 ++--
 13 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/catalogue/CreateAdminHostCmdLineArgs.cpp b/catalogue/CreateAdminHostCmdLineArgs.cpp
index 1331e8d0ce..df55d7fee5 100644
--- a/catalogue/CreateAdminHostCmdLineArgs.cpp
+++ b/catalogue/CreateAdminHostCmdLineArgs.cpp
@@ -31,7 +31,7 @@ namespace catalogue {
 CreateAdminHostCmdLineArgs::CreateAdminHostCmdLineArgs(const int argc, char *const *const argv):
   help(false) {
   static struct option longopts[] = {
-    {"comment"  , required_argument, NULL, 'c'},
+    {"comment"  , required_argument, NULL, 'm'},
     {"help"     ,       no_argument, NULL, 'h'},
     {"hostname" , required_argument, NULL, 'n'},
     {NULL       ,                 0, NULL,   0}
@@ -42,9 +42,9 @@ CreateAdminHostCmdLineArgs::CreateAdminHostCmdLineArgs(const int argc, char *con
   opterr = 0;
 
   int opt = 0;
-  while((opt = getopt_long(argc, argv, ":c:hn:", longopts, NULL)) != -1) {
+  while((opt = getopt_long(argc, argv, ":m:hn:", longopts, NULL)) != -1) {
     switch(opt) {
-    case 'c':
+    case 'm':
       comment = optarg ? optarg : "";
       break;
     case 'h':
@@ -99,7 +99,7 @@ CreateAdminHostCmdLineArgs::CreateAdminHostCmdLineArgs(const int argc, char *con
     // Check the number of arguments
   if(nbArgs != 1) {
     exception::CommandLineNotParsed ex;
-    ex.getMessage() << "Wrong number of command-line arguments: excepted=1 actual=" << nbArgs;
+    ex.getMessage() << "Wrong number of command-line arguments: expected=1 actual=" << nbArgs;
     throw ex;
   }
 
@@ -112,7 +112,7 @@ CreateAdminHostCmdLineArgs::CreateAdminHostCmdLineArgs(const int argc, char *con
 void CreateAdminHostCmdLineArgs::printUsage(std::ostream &os) {
   os <<
     "Usage:" << std::endl <<
-    "    cta-catalogue-admin-host-create databaseConnectionFile -n <hostname> -c <comment> [-h]" << std::endl <<
+    "    cta-catalogue-admin-host-create databaseConnectionFile -n <hostname> -m <comment> [-h]" << std::endl <<
     "Where:" << std::endl <<
     "    databaseConnectionFile" << std::endl <<
     "        The path to the file containing the connection details of the CTA" << std::endl <<
@@ -120,7 +120,7 @@ void CreateAdminHostCmdLineArgs::printUsage(std::ostream &os) {
     "Options:" << std::endl <<
     "    -n,--hostname <hostname>" << std::endl <<
     "        The name of the admin host to be created" << std::endl <<
-    "    -c,--comment <comment>" << std::endl <<
+    "    -m,--comment <comment>" << std::endl <<
     "        Comment to describe the creation of the admin host" << std::endl <<
     "    -h,--help" << std::endl <<
     "        Prints this usage message" << std::endl <<
diff --git a/catalogue/CreateAdminHostCmdLineArgsTest.cpp b/catalogue/CreateAdminHostCmdLineArgsTest.cpp
index 09def8cf66..eae7e14835 100644
--- a/catalogue/CreateAdminHostCmdLineArgsTest.cpp
+++ b/catalogue/CreateAdminHostCmdLineArgsTest.cpp
@@ -116,7 +116,7 @@ TEST_F(cta_catalogue_CreateAdminHostCmdLineArgsTest, hostname_short) {
   args->argv[1] = dupString("dbConfigPath");
   args->argv[2] = dupString("-n");
   args->argv[3] = dupString("adminHostname");
-  args->argv[4] = dupString("-c");
+  args->argv[4] = dupString("-m");
   args->argv[5] = dupString("comment");
   args->argv[6] = NULL;
 
diff --git a/catalogue/CreateAdminUserCmdLineArgs.cpp b/catalogue/CreateAdminUserCmdLineArgs.cpp
index bc34a061a8..b68290fd47 100644
--- a/catalogue/CreateAdminUserCmdLineArgs.cpp
+++ b/catalogue/CreateAdminUserCmdLineArgs.cpp
@@ -31,7 +31,7 @@ namespace catalogue {
 CreateAdminUserCmdLineArgs::CreateAdminUserCmdLineArgs(const int argc, char *const *const argv):
   help(false) {
   static struct option longopts[] = {
-    {"comment"  , required_argument, NULL, 'c'},
+    {"comment"  , required_argument, NULL, 'm'},
     {"help"     ,       no_argument, NULL, 'h'},
     {"username" , required_argument, NULL, 'u'},
     {NULL       ,                 0, NULL,   0}
@@ -42,9 +42,9 @@ CreateAdminUserCmdLineArgs::CreateAdminUserCmdLineArgs(const int argc, char *con
   opterr = 0;
 
   int opt = 0;
-  while((opt = getopt_long(argc, argv, ":c:hu:", longopts, NULL)) != -1) {
+  while((opt = getopt_long(argc, argv, ":m:hu:", longopts, NULL)) != -1) {
     switch(opt) {
-    case 'c':
+    case 'm':
       comment = optarg ? optarg : "";
       break;
     case 'h':
@@ -99,7 +99,7 @@ CreateAdminUserCmdLineArgs::CreateAdminUserCmdLineArgs(const int argc, char *con
     // Check the number of arguments
   if(nbArgs != 1) {
     exception::CommandLineNotParsed ex;
-    ex.getMessage() << "Wrong number of command-line arguments: excepted=1 actual=" << nbArgs;
+    ex.getMessage() << "Wrong number of command-line arguments: expected=1 actual=" << nbArgs;
     throw ex;
   }
 
@@ -112,7 +112,7 @@ CreateAdminUserCmdLineArgs::CreateAdminUserCmdLineArgs(const int argc, char *con
 void CreateAdminUserCmdLineArgs::printUsage(std::ostream &os) {
   os <<
     "Usage:" << std::endl <<
-    "    cta-catalogue-admin-user-create databaseConnectionFile -u <username> -c <comment> [-h]" << std::endl <<
+    "    cta-catalogue-admin-user-create databaseConnectionFile -u <username> -m <comment> [-h]" << std::endl <<
     "Where:" << std::endl <<
     "    databaseConnectionFile" << std::endl <<
     "        The path to the file containing the connection details of the CTA" << std::endl <<
@@ -120,7 +120,7 @@ void CreateAdminUserCmdLineArgs::printUsage(std::ostream &os) {
     "Options:" << std::endl <<
     "    -u,--username <username>" << std::endl <<
     "        The name of the admin user to be created" << std::endl <<
-    "    -c,--comment <comment>" << std::endl <<
+    "    -m,--comment <comment>" << std::endl <<
     "        Comment to describe the creation of the admin user" << std::endl <<
     "    -h,--help" << std::endl <<
     "        Prints this usage message" << std::endl <<
diff --git a/catalogue/CreateAdminUserCmdLineArgsTest.cpp b/catalogue/CreateAdminUserCmdLineArgsTest.cpp
index 1507f8f6f2..9e707b970b 100644
--- a/catalogue/CreateAdminUserCmdLineArgsTest.cpp
+++ b/catalogue/CreateAdminUserCmdLineArgsTest.cpp
@@ -116,7 +116,7 @@ TEST_F(cta_catalogue_CreateAdminUserCmdLineArgsTest, username_short) {
   args->argv[1] = dupString("dbConfigPath");
   args->argv[2] = dupString("-u");
   args->argv[3] = dupString("adminUsername");
-  args->argv[4] = dupString("-c");
+  args->argv[4] = dupString("-m");
   args->argv[5] = dupString("comment");
   args->argv[6] = NULL;
 
diff --git a/catalogue/CreateSchemaCmdLineArgs.cpp b/catalogue/CreateSchemaCmdLineArgs.cpp
index 880a2f6f71..ec27f661f2 100644
--- a/catalogue/CreateSchemaCmdLineArgs.cpp
+++ b/catalogue/CreateSchemaCmdLineArgs.cpp
@@ -84,7 +84,7 @@ CreateSchemaCmdLineArgs::CreateSchemaCmdLineArgs(const int argc, char *const *co
   // Check the number of arguments
   if(nbArgs != 1) {
     exception::CommandLineNotParsed ex;
-    ex.getMessage() << "Wrong number of command-line arguments: excepted=1 actual=" << nbArgs;
+    ex.getMessage() << "Wrong number of command-line arguments: expected=1 actual=" << nbArgs;
     throw ex;
   }
 
diff --git a/catalogue/DropSchemaCmdLineArgs.cpp b/catalogue/DropSchemaCmdLineArgs.cpp
index 8cd404ffbf..33abba00a4 100644
--- a/catalogue/DropSchemaCmdLineArgs.cpp
+++ b/catalogue/DropSchemaCmdLineArgs.cpp
@@ -84,7 +84,7 @@ DropSchemaCmdLineArgs::DropSchemaCmdLineArgs(const int argc, char *const *const
   // Check the number of arguments
   if(nbArgs != 1) {
     exception::CommandLineNotParsed ex;
-    ex.getMessage() << "Wrong number of command-line arguments: excepted=1 actual=" << nbArgs;
+    ex.getMessage() << "Wrong number of command-line arguments: expected=1 actual=" << nbArgs;
     throw ex;
   }
 
diff --git a/catalogue/PollDatabaseCmdLineArgs.cpp b/catalogue/PollDatabaseCmdLineArgs.cpp
index 3fe9bc96a2..6963ca5d32 100644
--- a/catalogue/PollDatabaseCmdLineArgs.cpp
+++ b/catalogue/PollDatabaseCmdLineArgs.cpp
@@ -87,7 +87,7 @@ PollDatabaseCmdLineArgs::PollDatabaseCmdLineArgs(const int argc, char *const *co
   // Check the number of arguments
   if(nbArgs != 2) {
     exception::CommandLineNotParsed ex;
-    ex.getMessage() << "Wrong number of command-line arguments: excepted=2 actual=" << nbArgs;
+    ex.getMessage() << "Wrong number of command-line arguments: expected=2 actual=" << nbArgs;
     throw ex;
   }
 
diff --git a/catalogue/cta-catalogue-admin-host-create.1cta b/catalogue/cta-catalogue-admin-host-create.1cta
index 5056f164a7..8876802544 100644
--- a/catalogue/cta-catalogue-admin-host-create.1cta
+++ b/catalogue/cta-catalogue-admin-host-create.1cta
@@ -17,7 +17,7 @@
 .SH NAME
 cta-catalogue-admin-host-create \- Create a CTA admin host
 .SH SYNOPSIS
-.BI "cta-catalogue-admin-host-create databaseConnectionFile -n <hostname> -c <comment> [-h]"
+.BI "cta-catalogue-admin-host-create databaseConnectionFile -n <hostname> -m <comment> [-h]"
 
 .SH DESCRIPTION
 \fBcta-catalogue-admin-host-create\fP is a command-line tool that creates an
@@ -36,7 +36,7 @@ CTA catalogue database.
 \fB\-n, \-\-hostname <hostname>
 The name of the admin host to be created.
 .TP
-\fB\-c, \-\-comment <comment>
+\fB\-m, \-\-comment <comment>
 Comment describing the creation of the admin host.
 .TP
 \fB\-h, \-\-help
diff --git a/catalogue/cta-catalogue-admin-user-create.1cta b/catalogue/cta-catalogue-admin-user-create.1cta
index 543b3fba70..2c7f93ae7b 100644
--- a/catalogue/cta-catalogue-admin-user-create.1cta
+++ b/catalogue/cta-catalogue-admin-user-create.1cta
@@ -17,7 +17,7 @@
 .SH NAME
 cta-catalogue-admin-user-create \- Create a CTA admin user
 .SH SYNOPSIS
-.BI "cta-catalogue-admin-user-create databaseConnectionFile -u <username> -c <comment> [-h]"
+.BI "cta-catalogue-admin-user-create databaseConnectionFile -u <username> -m <comment> [-h]"
 
 .SH DESCRIPTION
 \fBcta-catalogue-admin-user-create\fP is a command-line tool that creates an
@@ -36,7 +36,7 @@ CTA catalogue database.
 \fB\-u, \-\-username <username>
 The name of the admin user to be created.
 .TP
-\fB\-c, \-\-comment <comment>
+\fB\-m, \-\-comment <comment>
 Comment describing the creation of the admin user.
 .TP
 \fB\-h, \-\-help
diff --git a/continuousintegration/orchestration/tests/prepare_tests.sh b/continuousintegration/orchestration/tests/prepare_tests.sh
index f5105d372e..d911505184 100755
--- a/continuousintegration/orchestration/tests/prepare_tests.sh
+++ b/continuousintegration/orchestration/tests/prepare_tests.sh
@@ -58,11 +58,11 @@ cat ${tempdir}/library-rc.sh
 ctacliIP=`kubectl --namespace ${NAMESPACE} describe pod ctacli | grep IP | sed -E 's/IP:[[:space:]]+//'`
 
 echo "Preparing CTA configuration for tests"
-  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -c "docker cli"
+  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -m "docker cli"
   # to allow client connecting to dual stack IPv6/IPv4 xrootd server
   # otherwise only use IPv4 by adding '-I v4' to ExecStart line in /etc/systemd/system/cta-frontend.service
-  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname [::ffff:${ctacliIP}] -c "docker cli"
-  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username ctaadmin1 -c "docker cli"
+  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname [::ffff:${ctacliIP}] -m "docker cli"
+  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username ctaadmin1 -m "docker cli"
   kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin logicallibrary add \
      --name ${LIBRARYNAME}                                            \
      --comment "ctasystest"                                           
diff --git a/continuousintegration/orchestration/tests/systest.sh b/continuousintegration/orchestration/tests/systest.sh
index 54f779d952..b040006485 100755
--- a/continuousintegration/orchestration/tests/systest.sh
+++ b/continuousintegration/orchestration/tests/systest.sh
@@ -58,8 +58,8 @@ cat ${tempdir}/library-rc.sh
 ctacliIP=`kubectl --namespace ${NAMESPACE} describe pod ctacli | grep IP | sed -E 's/IP:[[:space:]]+//'`
 
 echo "Preparing CTA for tests"
-  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -c "docker cli"
-  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username admin1 -c "docker cli"
+  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -m "docker cli"
+  kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username admin1 -m "docker cli"
   kubectl --namespace ${NAMESPACE} exec ctacli -- cta logicallibrary add \
      --name ${LIBRARYNAME}                                            \
      --comment "ctasystest"                                           
diff --git a/continuousintegration/orchestration/tests/systest_xrdcp_many_concurrent_files.sh b/continuousintegration/orchestration/tests/systest_xrdcp_many_concurrent_files.sh
index 62eb88b846..45622843a1 100755
--- a/continuousintegration/orchestration/tests/systest_xrdcp_many_concurrent_files.sh
+++ b/continuousintegration/orchestration/tests/systest_xrdcp_many_concurrent_files.sh
@@ -58,8 +58,8 @@ cat ${tempdir}/library-rc.sh
 ctacliIP=`kubectl --namespace ${NAMESPACE} describe pod ctacli | grep IP | sed -E 's/IP:[[:space:]]+//'`
 
 echo "Preparing CTA for tests"
-kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -c "docker cli"
-kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username admin1 -c "docker cli"
+kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -m "docker cli"
+kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username admin1 -m "docker cli"
 kubectl --namespace ${NAMESPACE} exec ctacli -- cta logicallibrary add \
       --name ${LIBRARYNAME}                                            \
       --comment "ctasystest"                                           
diff --git a/continuousintegration/orchestration/tests/systest_xrdcp_many_files.sh b/continuousintegration/orchestration/tests/systest_xrdcp_many_files.sh
index 954ad73c72..28d123f22d 100755
--- a/continuousintegration/orchestration/tests/systest_xrdcp_many_files.sh
+++ b/continuousintegration/orchestration/tests/systest_xrdcp_many_files.sh
@@ -58,8 +58,8 @@ cat ${tempdir}/library-rc.sh
 ctacliIP=`kubectl --namespace ${NAMESPACE} describe pod ctacli | grep IP | sed -E 's/IP:[[:space:]]+//'`
 
 echo "Preparing CTA for tests"
-kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -c "docker cli"
-kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username admin1 -c "docker cli"
+kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-host-create /etc/cta/cta-catalogue.conf --hostname ${ctacliIP} -m "docker cli"
+kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username admin1 -m "docker cli"
 kubectl --namespace ${NAMESPACE} exec ctacli -- cta logicallibrary add \
       --name ${LIBRARYNAME}                                            \
       --comment "ctasystest"                                           
-- 
GitLab