diff options
| author | Avra Sengupta <asengupt@redhat.com> | 2012-12-12 17:34:43 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2012-12-18 19:15:15 -0800 | 
| commit | c9c0fe3f7d737b175dea3833071f3e54d2f412fa (patch) | |
| tree | 6e1b90471d723cb06244d475adba4f2521d6dfaa /cli | |
| parent | 020fc237765670432ae645ee104c4816d724c5ea (diff) | |
cli: Fixing the xml output in failure cases for gluster peer probe
Change-Id: I9ebec995cbf47d9ced7140e37787e74ff9c63769
BUG: 879490
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: http://review.gluster.org/4301
Reviewed-by: Kaushal M <kaushal@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/src/cli-rpc-ops.c | 6 | ||||
| -rw-r--r-- | cli/src/cli-xml-output.c | 18 | 
2 files changed, 16 insertions, 8 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index da239b51ec3..a5314378c25 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -179,8 +179,10 @@ gf_cli_probe_cbk (struct rpc_req *req, struct iovec *iov,          }          if (global_state->mode & GLUSTER_MODE_XML) { -                ret = cli_xml_output_str ("peerProbe", msg, rsp.op_ret, -                                          rsp.op_errno, NULL); +                ret = cli_xml_output_str (NULL, +                                          (rsp.op_ret == -1)? NULL : msg, +                                          rsp.op_ret, rsp.op_errno, +                                          (rsp.op_ret == -1)? msg : NULL);                  if (ret)                          gf_log ("cli", GF_LOG_ERROR,                                  "Error outputting to xml"); diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index ffe32caccdd..e4393266238 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -149,13 +149,19 @@ cli_xml_output_str (char *op, char *str, int op_ret, int op_errno,          if (ret)                  goto out; -        ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"cliOp", -                                               "%s", op); -        XML_RET_CHECK_AND_GOTO (ret, out); +        if (op) { +                ret = xmlTextWriterWriteFormatElement (writer, +                                                       (xmlChar *)"cliOp", +                                                       "%s", op); +                XML_RET_CHECK_AND_GOTO (ret, out); +        } -        ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"output", -                                               "%s", str); -        XML_RET_CHECK_AND_GOTO (ret, out); +        if (str) { +                ret = xmlTextWriterWriteFormatElement (writer, +                                                       (xmlChar *)"output", +                                                       "%s", str); +                XML_RET_CHECK_AND_GOTO (ret, out); +        }          ret = cli_end_xml_output (writer, buf);  | 
