You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See #351 for more info, but generally speaking there are two behaviors when using profiles that are just terrible.
<snip>
File "/home/wayne/mine/review-saltext/src/saltext/vmware/utils/connect.py", line 45, in get_config
credentials = conf[profile]
KeyError: 'fnord'
A huge stack trace appears when doing something like salt-call vmware_vm.list profile=fnord and the profile doesn't exist.
We could pretty easily catch a KeyError here and then look for profiles that might match, and provide a useful error/exit like "Profile 'fnord' does not exist. Perhaps you meant X?"
Alternatively, if you don't have any config data in the base and only have profiles, and do not provide a profile, you get this:
<snip>
File "/home/wayne/mine/review-saltext/src/saltext/vmware/utils/connect.py", line 134, in get_service_instance
config = get_config(config=config, profile=profile, esxi_host=esxi_host)
File "/home/wayne/mine/review-saltext/src/saltext/vmware/utils/connect.py", line 60, in get_config
raise ValueError("Cannot create service instance, VMware credentials incomplete.")
ValueError: Cannot create service instance, VMware credentials incomplete.
Also super useless.
Basically what we should do in this case is check if there's a host/user/pass, and if any of those things are missing then we should provide a useful message such as:
No credentials found in the base profile, and no profiles found.
Or
No credentials found in the base profile, but profiles <a, b, c> exist. Are you missing profile=a?
Something to that effect.
The text was updated successfully, but these errors were encountered:
This is the behavior when using connect.get_service_instance but a different handling/error is done when using connect.request which is used by other modules. Not sure how profiles are supposed to work, is there any guide for using them?
See #351 for more info, but generally speaking there are two behaviors when using profiles that are just terrible.
A huge stack trace appears when doing something like
salt-call vmware_vm.list profile=fnord
and the profile doesn't exist.We could pretty easily catch a KeyError here and then look for profiles that might match, and provide a useful error/exit like "Profile 'fnord' does not exist. Perhaps you meant X?"
Alternatively, if you don't have any config data in the base and only have profiles, and do not provide a profile, you get this:
Also super useless.
Basically what we should do in this case is check if there's a host/user/pass, and if any of those things are missing then we should provide a useful message such as:
Or
Something to that effect.
The text was updated successfully, but these errors were encountered: