-
Notifications
You must be signed in to change notification settings - Fork 95
Fix for error handling on set command in admin cli. #610
Conversation
Fixes #609 |
print('Successfully updated settings for : {0}'.format(args.volume)) | ||
else: | ||
print('Failed to update {0} for {1}.'.format(args.options, args.volume)) | ||
except Exception as ex: | ||
print('Failed to update {0} for {1}.'.format(args.options, args.volume)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print ex.message so user knows cause of failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on this.
WARNING:root:Invalid options: ['acces']
seems to be showing in the log, not sysout. Or is it in sysout ?
Can you clarify the exact print happening on typos here?
The error messages are all on the command line. I'll print the exception On Fri, Oct 7, 2016 at 2:16 AM, Mark Sterin notifications@github.com
|
@govint - can you please add the current error message (as printed by Admin CLI on this error, and some other error for comparison) so we can LGTM and merge this one ? |
Updated the change to ensure that exceptions are caught and the exception message is printed
[root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py set --options="acces=read-write" --volume=testvol-11@bigone
|
Fixes #609 |
* master: (25 commits) Update new ESX IP added forgotten .so file Install sqlite3 py libs on ESX and load for Python2 Added py code and binaries for sqlite3 python libs Update drone security Removed accidental .pyc files Handle byte to string conversions for status command. Auth configuration and operation admission check (Auth.liping) (vmware-archive#603) Revert "Cli auth.liping" Cli auth.liping (vmware-archive#640) Handle missing or invalid fs type on mount. (vmware-archive#639) Updated Admin CLI commands to support tenants. (vmware-archive#620) Workaround older versions of e2fsprogs (vmware-archive#631) Add auth proposal Made handing of missing metafile less harsh. (vmware-archive#627) Fixed ACLs in payload bin dir (vmware-archive#624) Fixed error handling for set command. (vmware-archive#610) Use new error variables when rolling back volume creation to avoid nil reassignment. (vmware-archive#617) Change wording Fix broken link ...
Modified vmdk_ops.py set_vol_opts() to not raise validation errors, surrounding code doesn't raise errors and instead log the errors as warnings. This was the only case where an exception was being raised and un-handled. Plus ValidationError is specific to vmdk_ops.py.
Test is already there for vmdkops_admin.py and vmdk_ops.py for access option.
Code now prints the error and the usage:
vmdkops_admin.py set --options="acces=read-write" --volume=testvol-11@bigone
WARNING:root:Invalid options: ['acces']
Options that can be edited: ['attach-as', 'access']
Failed to update acces=read-write for testvol-11@bigone.
vmdkops_admin.py set --options="access=read-write" --volume=testvol-11@bigone
Successfully updated settings for : testvol-11@bigone