nsidc / vagrant-vsphere

VMware vSphere provider for Vagrant
Other
608 stars 166 forks source link

Improve the documentation and/or error handling around custom attributes #260

Open jessemcallister opened 6 years ago

jessemcallister commented 6 years ago

When applying a custom_attribute, the key must already exist at the vSphere level otherwise you'll receive a less than helpful error, "InvalidArgument: A specified parameter was not correct: key", when running vagrant up.

This issue is not obvious, see https://github.com/ansible/ansible/issues/32004 and https://groups.google.com/forum/#!topic/ansible-project/Hk7gJNVz1dE, and not directly the fault of vagrant-sphere, however the documentation for custom_attribute could be improved to indicate that the key must already exist. Alternatively, the error could be caught in clone.rb and a more friendly error returned to the user.

If you run vagrant up --debug and trace the failure to clone.rb and then refer to the documentation for setCustomValue you'll see that InvalidArgument is "Thrown if no custom field with that key exists.". You then need to take the leap to understand that the error means you need to create the attribute at the vSphere level before being able to assign that attribute on a VM.