Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt-cloud 2015.5.0: missing azure dependency results in misleading error #24969

Closed
bradthurber opened this issue Jun 25, 2015 · 7 comments
Closed
Assignees
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 RIoT Relates to integration with cloud providers, hypervisors, API-based services, etc. Salt-Cloud severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@bradthurber
Copy link
Contributor

When using salt-cloud with Azure, if one forgets to install the required dependency Microsoft Azure for Python utils (pip install azure), they will receive the following misleading error

[WARNING ] The cloud driver, 'azure', configured under the 'providername' cloud provider alias was not loaded since 'azure.get_configured_provider()' could not be found. Removing it from the available providers list

This had me chasing all over the place for an azure.py file (which doesn't exist - as it is named msazure.py and aliased). Even when I found it, I was still confused as get_configured_provider() CAN be found in the source. I simply missed the dependency in the instructions.

Would it be possible to put in a more meaningful error message when it doesn't find the azure dependency?

@rallytime rallytime added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Salt-Cloud P3 Priority 3 RIoT Relates to integration with cloud providers, hypervisors, API-based services, etc. labels Jun 25, 2015
@rallytime rallytime added this to the Approved milestone Jun 25, 2015
@rallytime
Copy link
Contributor

@bradthurber Yeah, I think we can definitely be more helpful here. Thanks for the report.

@rallytime rallytime self-assigned this Jun 25, 2015
@rallytime rallytime modified the milestones: Be 3, Approved Jun 25, 2015
@rallytime
Copy link
Contributor

Ok, so after thinking about this a little more, this isn't going to be as simple as I thought. The problem is that if we put something helpful in the __virtual__ function, everyone will see it, regardless of whether or not they are using the azure driver. So, that isn't going to be an option.

The other problem is that if you can't get past the virtual function (which is actually what is happening when you hit that error), then you can't make sure the Python Azure SDK is installed when you call azure-specific functions. Therefore, the only place to put information like this is in the documentation.

However, to be fair, that error message is completely non-helpful. I'm looking into potentially providing a more helpful message there. I have been thrown by the some-driver.get_configured_provider() could not be found message many times.

@bradthurber
Copy link
Contributor Author

This error also is displayed if one or more of the required cloud provider parameters is missing - or heaven-forbid - it is there but spelled incorrectly! As an example, the Azure provider requires a subscription_id. If I happen to type it subscripion_id then we get the same ... 'azure.get_configured_provider()' could not be found.... message when using salt-cloud.

So in the "more helpful message" it looks like we need to point out at least 3 possible problems for the user to hunt down:

  • the provider they specified isn't available (the intent of the original message)
  • the provider prerequisites are not satisfied (Azure SDK for example)
  • one or more of the required provider parameters is missing or spelled incorrectly

@rallytime
Copy link
Contributor

@bradthurber So the only thing we'll be able to do here is change the error message to something a little more helpful. However, concerning your other points, we do have some other checks in place that are a little more helpful.

  1. "the provider they specified isn't available (the intent of the original message)" - This is already taken care of with the following message:
# salt-cloud --list-images parrallels
[INFO    ] salt-cloud starting

Error: There was an error listing images: No cloud providers matched 'parrallels'. Available selections: gce-config, azure-config, rackspace, ec2-config

Note that I don't have anything specified for the parallels provider. (The original confusing error in question only happens if the provider specified has something configured in a provider file.)

  1. "the provider prerequisites are not satisfied (Azure SDK for example)" - This is where we will need to be more helpful with that error, even if it will still be general. I'll submit a pull request for this shortly.
  2. "one or more of the required provider parameters is missing or spelled incorrectly" - This is already getting checked, but it is only logging at the trace level. I did some cleaning up around this recently in the develop branch with Check for required parameters in salt-cloud provider and profile configs #24913, but since that was a pretty big change, I opted to put it in develop. Here's an example, where I've commented out on of the required provider settings for ec2:
# salt-cloud --list-images ec2
[INFO    ] salt-cloud starting
[WARNING ] The required 'key' configuration setting is missing from the 'ec2' driver, which is configured under the 'ec2-config' alias.

[WARNING ] The cloud driver, 'ec2', configured under the 'ec2-config' cloud provider alias was not loaded since 'ec2.get_configured_provider()' could not be found. Removing it from the available providers list.
Error: There was an error listing images: No cloud providers matched 'ec2'. Available selections: gce-config, azure-config, rackspace

Note that the original confusing error in question is still hit. However, if you read up a bit, the very first warning tells you exactly what you're missing (or have misspelled).

@rallytime
Copy link
Contributor

@bradthurber Can you take a look at how I've changed the error in the pull request above? I think that will still cover most general cases, but provide a more realistic starting point to help trouble-shoot.

@bradthurber
Copy link
Contributor Author

@rallytime the new wording in #24999 is much better.

@rallytime
Copy link
Contributor

Thanks @bradthurber! Since this is a little more clear now, I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 RIoT Relates to integration with cloud providers, hypervisors, API-based services, etc. Salt-Cloud severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

2 participants