Skip to content

Check 'ceph orch status' output#283

Merged
ricardoasmarques merged 1 commit intoceph:masterfrom
ricardoasmarques:check-ceph-orch-status-result
Jul 16, 2020
Merged

Check 'ceph orch status' output#283
ricardoasmarques merged 1 commit intoceph:masterfrom
ricardoasmarques:check-ceph-orch-status-result

Conversation

@ricardoasmarques
Copy link
Contributor

@ricardoasmarques ricardoasmarques commented Jul 1, 2020

After ceph/ceph#35805 is backported (ceph/ceph#35898)


Instead of simply rely on return code, we need to check if "available: true" is returned, because:

master:~ # ceph orch status --format=json

{"available": true, "backend": "cephadm"}
master:~ # echo $?
0

master:~ # ceph cephadm clear-key

master:~ # ceph orch status --format=json

{"available": false, "backend": "cephadm", "reason": "SSH keys not set. Use `ceph cephadm set-priv-key` and `ceph cephadm set-pub-key` or `ceph cephadm generate-key`"}

master:~ # echo $?
0

Signed-off-by: Ricardo Marques rimarques@suse.com

@ricardoasmarques ricardoasmarques added bug Something isn't working Add To Changelog Marks the PR to be included in the changelog of the next version release DNM blocked-by-cephadm labels Jul 1, 2020
@ricardoasmarques ricardoasmarques changed the title [After ceph/ceph#35805] Check ceph orch status output Check ceph orch status output Jul 15, 2020
@ricardoasmarques ricardoasmarques force-pushed the check-ceph-orch-status-result branch from 89985bd to 41d7a0d Compare July 15, 2020 10:16
if status_ret['retcode'] != 0:
return False
status = json.loads(status_ret['stdout'])
if not status.get('available'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status.get('available', False) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Instead of simply rely on return code, we need to check
if "available: true" is returned.

Signed-off-by: Ricardo Marques <rimarques@suse.com>
@ricardoasmarques ricardoasmarques force-pushed the check-ceph-orch-status-result branch from 41d7a0d to b360d74 Compare July 15, 2020 14:30
@smithfarm smithfarm changed the title Check ceph orch status output Check 'ceph orch status' output Jul 15, 2020
@ricardoasmarques ricardoasmarques merged commit 8b19046 into ceph:master Jul 16, 2020
@ricardoasmarques ricardoasmarques removed the Add To Changelog Marks the PR to be included in the changelog of the next version release label Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants