Skip to content

Commit

Permalink
fix(charm): local charm deploy fails due to bad source
Browse files Browse the repository at this point in the history
At juju#18413 we introduced the Source when
retrieving a charm ID, which was in turn needed to deploy.
This small patch fixes the deploy of a local charm because the Source
was not being injected on that code path.
  • Loading branch information
nvinuesa committed Nov 26, 2024
1 parent 302b6c0 commit 567ed88
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apiserver/facades/client/application/application_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,21 @@ func (api *APIBase) getCharmID(ctx context.Context, charmURL string) (corecharm.
return "", errors.Annotate(err, "parsing charm URL")
}

charmSource, err := applicationcharm.ParseCharmSchema(charm.Schema(curl.Schema))
if err != nil {
return "", errors.Trace(err)
}
charmID, err := api.applicationService.GetCharmID(ctx, applicationcharm.GetCharmArgs{
Name: curl.Name,
Revision: ptr(curl.Revision),
Source: charmSource,
})
if errors.Is(err, applicationerrors.CharmNotFound) {
return "", errors.NotFoundf("charm %q", charmURL)
} else if errors.Is(err, applicationerrors.CharmNameNotValid) {
return "", errors.NotValidf("charm %q", charmURL)
} else if errors.Is(err, applicationerrors.CharmSourceNotValid) {
return "", errors.NotValidf("charm %q", charmURL)
} else if err != nil {
return "", errors.Annotate(err, "getting charm id")
}
Expand Down

0 comments on commit 567ed88

Please sign in to comment.