Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

typo in vmdkops_admin.py set throws an exception #609

Closed
msterin opened this issue Oct 4, 2016 · 3 comments
Closed

typo in vmdkops_admin.py set throws an exception #609

msterin opened this issue Oct 4, 2016 · 3 comments
Assignees
Labels

Comments

@msterin
Copy link
Contributor

msterin commented Oct 4, 2016

On master, reproducable - a mistake in admin 'set' command throws:

root@sc2-rdops-vm02-dhcp-90-23:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py set --volume what@datastore1  --options acces=read-only
Traceback (most recent call last):
  File "/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py", line 638, in <module>
    main()
  File "/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py", line 40, in main
    args.func(args)
  File "/usr/lib/vmware/vmdkops/bin/vmdkops_admin.py", line 566, in set_vol_opts
    set_ok = vmdk_ops.set_vol_opts(args.volume, args.options) 
  File "/usr/lib/vmware/vmdkops/bin/vmdk_ops.py", line 1042, in set_vol_opts
    raise ValidationError(msg)
vmdk_ops.ValidationError: "Invalid options: ['acces'] \nOptions that can be edited: ['access', 'attach-as']"

@govint - assigning to you since you where the last who touched set_vol_opts:1042

@govint
Copy link
Contributor

govint commented Oct 5, 2016

Ah, its working as expected "access" is supported, "acces" isn't access :-)). Will fix the exception handling in the cli

@andrewjstone
Copy link
Contributor

No, this is a user facing CLI. Errors should not just be uncaught exceptions. They should look more like this:

root@localhost:~] /usr/lib/vmware/vmdkops/bin/vmdkops_admin.py lsadfadf
usage: vmdkops_admin.py [-h] {policy,status,set,role,ls} ...
vmdkops_admin.py: error: invalid choice: 'lsadfadf' (choose from 'policy', 'status', 'set', 'role', 'ls')

@msterin
Copy link
Contributor Author

msterin commented Oct 5, 2016

Exactly - it should be an error msg like in all other places, not a backtrace

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants