From 7bb9b3c229fc75e5ea0347c08982823b4533fe48 Mon Sep 17 00:00:00 2001 From: Peter Stachowski Date: Fri, 6 May 2016 12:23:31 -0400 Subject: [PATCH] Persist error messages and display on 'show' Format the fault nicely on the Trove 'show' command. Change-Id: I92777ea410e8df21169fddcfdc0de1f5ca00e7bd Implements: blueprint persist-error-message --- .../notes/persist-error-message-cda8dfe485fe92ba.yaml | 4 ++++ troveclient/v1/shell.py | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 releasenotes/notes/persist-error-message-cda8dfe485fe92ba.yaml diff --git a/releasenotes/notes/persist-error-message-cda8dfe485fe92ba.yaml b/releasenotes/notes/persist-error-message-cda8dfe485fe92ba.yaml new file mode 100644 index 00000000..78c04ab7 --- /dev/null +++ b/releasenotes/notes/persist-error-message-cda8dfe485fe92ba.yaml @@ -0,0 +1,4 @@ +--- +features: + - Support added for error messages when running the + Trove show command. diff --git a/troveclient/v1/shell.py b/troveclient/v1/shell.py index 666ba3cb..6ff9785d 100644 --- a/troveclient/v1/shell.py +++ b/troveclient/v1/shell.py @@ -88,6 +88,12 @@ def _print_instance(instance): if hasattr(instance, 'replicas'): replicas = [replica['id'] for replica in instance.replicas] info['replicas'] = ', '.join(replicas) + if hasattr(instance, 'fault'): + info.pop('fault', None) + info['fault'] = instance.fault['message'] + info['fault_date'] = instance.fault['created'] + if 'details' in instance.fault and instance.fault['details']: + info['fault_details'] = instance.fault['details'] info.pop('links', None) utils.print_dict(info)