[Midnightbsd-cvs] src [9439] trunk/sbin/hastctl: Add 'list' command, for now the exact equivalent of 'status',

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Mar 5 13:18:46 EST 2017


Revision: 9439
          http://svnweb.midnightbsd.org/src/?rev=9439
Author:   laffer1
Date:     2017-03-05 13:18:46 -0500 (Sun, 05 Mar 2017)
Log Message:
-----------
Add 'list' command, for now the exact equivalent of 'status',
so users of the latter could change their scripts.

Modified Paths:
--------------
    trunk/sbin/hastctl/hastctl.8
    trunk/sbin/hastctl/hastctl.c

Modified: trunk/sbin/hastctl/hastctl.8
===================================================================
--- trunk/sbin/hastctl/hastctl.8	2017-03-05 16:17:27 UTC (rev 9438)
+++ trunk/sbin/hastctl/hastctl.8	2017-03-05 18:18:46 UTC (rev 9439)
@@ -27,7 +27,7 @@
 .\"
 .\" $MidnightBSD$
 .\"
-.Dd April 10, 2011
+.Dd May 24, 2013
 .Dt HASTCTL 8
 .Os
 .Sh NAME
@@ -49,6 +49,11 @@
 .Aq init | primary | secondary
 .Ar all | name ...
 .Nm
+.Cm list
+.Op Fl d
+.Op Fl c Ar config
+.Op Ar all | name ...
+.Nm
 .Cm status
 .Op Fl d
 .Op Fl c Ar config
@@ -139,8 +144,19 @@
 .Pa /dev/hast/<name>
 will not be created on secondary node.
 .El
+.It Cm list
 .It Cm status
-Present status of the configured resources.
+Present verbose status of the configured resources.
+For now, list and status commands are equivalent.
+In the near future the output of 
+.Nm
+status command will change to more terse format.
+If you use `
+.Nm
+status' for parsing in your scripts, switch to `
+.Nm
+list'.
+
 .It Cm dump
 Dump metadata stored on local component for the configured resources.
 .El

Modified: trunk/sbin/hastctl/hastctl.c
===================================================================
--- trunk/sbin/hastctl/hastctl.c	2017-03-05 16:17:27 UTC (rev 9438)
+++ trunk/sbin/hastctl/hastctl.c	2017-03-05 18:18:46 UTC (rev 9439)
@@ -70,7 +70,8 @@
 	CMD_CREATE,
 	CMD_ROLE,
 	CMD_STATUS,
-	CMD_DUMP
+	CMD_DUMP,
+	CMD_LIST
 };
 
 static __dead2 void
@@ -85,6 +86,9 @@
 	    "       %s role [-d] [-c config] <init | primary | secondary> all | name ...\n",
 	    getprogname());
 	fprintf(stderr,
+	    "       %s list [-d] [-c config] [all | name ...]\n",
+	    getprogname());
+	fprintf(stderr,
 	    "       %s status [-d] [-c config] [all | name ...]\n",
 	    getprogname());
 	fprintf(stderr,
@@ -381,6 +385,9 @@
 	} else if (strcmp(argv[1], "role") == 0) {
 		cmd = CMD_ROLE;
 		optstr = "c:dh";
+	} else if (strcmp(argv[1], "list") == 0) {
+		cmd = CMD_LIST;
+		optstr = "c:dh";
 	} else if (strcmp(argv[1], "status") == 0) {
 		cmd = CMD_STATUS;
 		optstr = "c:dh";
@@ -469,6 +476,7 @@
 		for (ii = 0; ii < argc - 1; ii++)
 			nv_add_string(nv, argv[ii + 1], "resource%d", ii);
 		break;
+	case CMD_LIST:
 	case CMD_STATUS:
 		/* Obtain status of the given resources. */
 		nv = nv_alloc();
@@ -524,6 +532,7 @@
 	case CMD_ROLE:
 		error = control_set_role(nv, argv[0]);
 		break;
+	case CMD_LIST:
 	case CMD_STATUS:
 		error = control_status(nv);
 		break;



More information about the Midnightbsd-cvs mailing list