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

provider/azure: Provide a simpler error when using a Platform Image without a Storage Service #2861

Merged
merged 3 commits into from
Jul 30, 2015

Conversation

catsby
Copy link
Contributor

@catsby catsby commented Jul 27, 2015

Currently, when attempting to use a Platform Image without a Storage Service, you get a cryptic and misleading error:

Error applying plan:

1 error(s) occurred:

* azure_instance.web: Could not find image with label 'OpenLogic 6.5'. Available images are: CDH 5.1 Evaluation, Microsoft Azure Site Recovery Configuration Server, Microsoft Azure Site Recovery Configuration Server, Microsoft Azure Site Recovery Master Target Server, Microsoft Azure Site Recovery Master Target Server, Microsoft Azure Site Recovery Process Server, Microsoft Azure Site Recovery Process Server, HDP 2.1.5 with 16 data disks, HDP 2.1.5 with 8 data disks, Hortonworks Sandbox with HDP 2.2.4-2, Hortonworks Sandbox with HDP 2.2, Hortonworks Sandbox with HDP 2.2.4-2v2, Hortonworks Sandbox with HDP 2.2.4-2v3, Hortonworks Sandbox with HDP 2.2.4-2v4, Hortonworks Sandbox with HDP 2.2.4-2v5, ...... 

The error is originating here:

But we're swallowing that specific error and returning a more generic one here:

This obfuscates what the underlying problem is and the user can't self-diagnose and correct.

My patch does a few things, and we can pick what we like:

  • Adds a note to the documentation that Platform Images require a Storage Service
  • Introduces a generic errors file to consolidate some common errors, but only has a PlatformStorageError for now
  • Checks for PlatformStorageError after retrieveOSImageDetails, and returns that error afterwards

New output:

Error applying plan:

1 error(s) occurred:

* azure_instance.web: When using a platform image, the 'storage' parameter is required

I've introduced the specific errors here to help trap any errors thrown but also maintain the current fall-through flow in retrieveImageDetails (if retrieveVMImageDetails errors, then still try retrieveOSImageDetails, and error at the end).

@catsby
Copy link
Contributor Author

catsby commented Jul 27, 2015

cc @svanharmelen and @aznashwan for some Azure provider input, I'm new to it 😄

@svanharmelen
Copy link
Contributor

LGTM!

PR #2607 is likely going to change this part even more to make it even more user friendly (through it's a bit silent there lately), but until that PR is done and merged, this is a good intermediate step I think.

@@ -647,7 +651,7 @@ func retrieveOSImageDetails(
if img.MediaLink == "" {
if storage == "" {
return nil, "", nil,
fmt.Errorf("When using a platform image, the 'storage' parameter is required")
PlatformStorageError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extremely small nit, but since the line is now way shorter there's not much reason to place PlatformStorageError on it's own line... Through it doesn't hurt either of course! 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, it's better on one line 😄 , done in 4885874

catsby added a commit that referenced this pull request Jul 30, 2015
provider/azure: Provide a simpler error when using a Platform Image without a Storage Service
@catsby catsby merged commit 26b4163 into master Jul 30, 2015
@catsby catsby deleted the b-azure-instance-error branch July 30, 2015 14:28
@ghost
Copy link

ghost commented May 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants