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

Improve error message when failing to deploy a bundle. #318

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

hmlanigan
Copy link
Member

Description

User friendly error messages are appreciated by all, especially when it's easy to do.

Fixes: #280

Type of change

  • Bug fix (non-breaking change which fixes an issue)

QA steps

Manual QA steps should be done to test this PR.

provider juju {}
resource "juju_model" "testmodel" {
  name = "machinetest"
}
resource "juju_application" "ubuntu" {
  model = juju_model.testmodel.name
  charm {
    name = "charmed-kubernetes"
  }
}

@hmlanigan hmlanigan added this to the 0.10.0 milestone Sep 27, 2023
@hmlanigan hmlanigan requested a review from cderici September 27, 2023 20:15
if resolvedCharm.Error != nil {
return nil, resolvedCharm.Error
}
if resolvedCharm.Origin.Type == "bundle" {
return nil, jujuerrors.Errorf("%q is a bundle not a charm", input.CharmName)
Copy link

Choose a reason for hiding this comment

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

the message might be a bit nicer imo, but it still gives the info, so feel free to merge as is

Suggested change
return nil, jujuerrors.Errorf("%q is a bundle not a charm", input.CharmName)
return nil, jujuerrors.Errorf("unable to deploy bundles in the terraform provider, expected a charm, given bundle : %q", input.CharmName)

Copy link
Member Author

Choose a reason for hiding this comment

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

I was debating, the full printed message to the user is

Unable to create application, got error: "charmed-kubernetes" is a bundle not a charm

User friendly error messages are appreciated by all, especially when
it's easy to do. Update docs to be clear an application resource
will not deploy bundles.
@hmlanigan hmlanigan force-pushed the bundle-friendly-error branch from a80af78 to 2b649a0 Compare September 27, 2023 21:15
@hmlanigan hmlanigan merged commit 2763392 into juju:main Sep 28, 2023
@hmlanigan hmlanigan deleted the bundle-friendly-error branch September 28, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gracefully fail to deploy a bundle
2 participants