Set action output for get_health

Change-Id: I23287bd153f1e61a94593734b1de43ef6abad36a
Closes-Bug: 1808189
This commit is contained in:
Chris MacNaughton 2018-12-13 09:06:40 +01:00
parent e7c2c31fa7
commit d78297c6b3
2 changed files with 8 additions and 2 deletions

View File

@ -66,7 +66,7 @@ def get_health():
On error, 'unknown' is returned.
"""
try:
value = check_output(['ceph', 'health'])
value = check_output(['ceph', 'health']).decode('utf-8')
return value
except CalledProcessError as e:
action_fail(e.message)

View File

@ -1,6 +1,12 @@
#!/usr/bin/python
from ceph_ops import get_health
from charmhelpers.core.hookenv import log, action_set, action_fail
if __name__ == '__main__':
get_health()
try:
action_set({'message': get_health()})
except CalledProcessError as e:
log(e)
action_fail(
"ceph health failed with message: {}".format(str(e)))