vmware-archive / vmware-vcenter

VMware vCenter Module
Other
87 stars 102 forks source link

Added better validation of transport in vcenter provider #191

Closed crayfishx closed 8 years ago

crayfishx commented 8 years ago

As raised in #186 when you don't pass, or pass a malformed, transport metaparameter you get some rather cryptic errors that are hard to track down - this PR adds some sanity checking to the vcenter provider when vim is called.

It checks on 4 factors...

vc_datacenter { 'foo': .... } # Missing transport
Could not evaluate: No transport metaparameter provided for Vc_datacenter[foo]
vc_datacenter { 'foo':... transport => Transport['missing'] } # undeclared transport
Could not evaluate: Transport Transport[missing] not defined for Vc_datacenter[foo]
vc_datacenter { 'foo': .... transport => "bad string" } # non-resource reference
Could not evaluate: Invalid transport bad string provided for Vc_datacenter[foo]
vc_datacenter { 'foo': .... transport => Package['foo'] } # Not a Transport type
Could not evaluate: Transport metaparameter must be of type Transport for Vc_datacenter[foo]
nanliu commented 8 years ago

@crayfishx late to the party, but this would be much better migrated to transport lib and since it will catch this class of errors for all transport related resources and not just vcenter.