summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-09-18 12:35:10 -0400
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-09-18 12:35:10 -0400
commitcde69cc294a79b1fa478aa7f0e3c8b96ed15ebd5 (patch)
tree2387fd3f4142d2ffbd4a78a87aec853360f2bdcd
parenta7dd519b58c9f68d0b74bd6fb5daaf88e84ece63 (diff)
vtysh: warn on cli targeting non-running daemon
Presently CLI entered for daemons which are not running is accepted quietly, which can be confusing for users. This patch warns about it when possible. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--vtysh/vtysh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index e8968ab896..78e64c1509 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -425,6 +425,12 @@ static int vtysh_execute_func(const char *line, int pager)
cmd_stat = CMD_SUCCESS;
for (i = 0; i < array_size(vtysh_client); i++) {
if (cmd->daemon & vtysh_client[i].flag) {
+ if (vtysh_client[i].fd < 0
+ && (cmd->daemon == vtysh_client[i].flag)) {
+ fprintf(stderr, "%s is not running\n",
+ vtysh_client[i].name);
+ continue;
+ }
cmd_stat = vtysh_client_execute(
&vtysh_client[i], line, fp);
if (cmd_stat != CMD_SUCCESS)