src/ceph-crash.in: print stderr if available

This is not perfect, but we have seen cases where the CLI returns 0 even
on failure.
For instance:

```sh
[root@rook-ceph-crashcollector-compute-1-66bdfbd886-d2zcd /]# ceph -n client.crash crash post -i /var/lib/ceph/crash/2021-06-28T07\:47\:37.859766Z_6ffb119c-930e-4047-9cfa-a92af783cdd0/meta
malformed crash metadata: time data '2021-06-28T07:47:37.859766' does not match format '%Y-%m-%d %H:%M:%S.%f'
[root@rook-ceph-crashcollector-compute-1-66bdfbd886-d2zcd /]# echo $?
0
```

So until we find the root cause, let's mitigate and perhaps accomodate
for futur similar issues.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2021-06-28 18:49:15 +02:00
parent cb5d766710
commit a77b47eeeb

View File

@ -51,7 +51,7 @@ def post_crash(path):
stderr = pr.communicate(input=f.read())
rc = pr.wait()
f.close()
if rc != 0:
if rc != 0 or stderr != "":
log.warning('post %s as %s failed: %s' % (path, n, stderr))
if rc == 0:
break