Michael Pasternak has uploaded a new change for review. Change subject: cli: fail nicely on AttributeError #959740 ......................................................................
cli: fail nicely on AttributeError #959740 Change-Id: I534beb603be224a8103d5900ea6fb34b5315a18b Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=959740 Signed-off-by: Michael pasternak <mpast...@redhat.com> --- M src/cli/messages.py M src/ovirtcli/command/command.py 2 files changed, 5 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/39/14539/1 diff --git a/src/cli/messages.py b/src/cli/messages.py index 1c38bf6..7b109b3 100644 --- a/src/cli/messages.py +++ b/src/cli/messages.py @@ -50,6 +50,7 @@ INVALID_KWARGS_FORMAT = '"%s" is invalid --kwargs argument, valid format is "x=y;z=q;...".' INVALID_KWARGS_CONTENT = '--kwargs constraint cannot be empty.' MISSING_CONFIGURATION_VARIABLE = 'missing configuration variable: %s.' + UNSUPPORTED_ATTRIBUTE = 'object construction failure, this could happen if you using unsupported option, please see help for the given command for more details.' class Warning(): CANNOT_FETCH_HOST_CERT_SUBJECT = 'could not fetch host certificate info.' CANNOT_FETCH_HOST_CERT_SUBJECT_LEGACY_SDK = 'could not fetch host certificate info cause used backend/sdk does not support it.' diff --git a/src/ovirtcli/command/command.py b/src/ovirtcli/command/command.py index 202c7e1..d405a8f 100644 --- a/src/ovirtcli/command/command.py +++ b/src/ovirtcli/command/command.py @@ -473,7 +473,10 @@ # TODO: throw error if param is mandatory pass - result = method(**method_args) + try: + result = method(**method_args) + except AttributeError: + self.error(Messages.Error.UNSUPPORTED_ATTRIBUTE) else: result = method() return result -- To view, visit http://gerrit.ovirt.org/14539 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I534beb603be224a8103d5900ea6fb34b5315a18b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Michael Pasternak <mpast...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches