Skip to content

Commit

Permalink
Remove support for charm store charms the resources package.
Browse files Browse the repository at this point in the history
Charm store charm support is being removed across juju. A few changes to stop
using deprecated methods in the errors package.
  • Loading branch information
hmlanigan committed Dec 13, 2022
1 parent 7fc3b3f commit 7628d14
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 217 deletions.
96 changes: 0 additions & 96 deletions resource/charmstore.go

This file was deleted.

113 changes: 0 additions & 113 deletions resource/charmstore_test.go

This file was deleted.

8 changes: 1 addition & 7 deletions resource/opener.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ func newInternalResourceOpener(
switch {
case charm.CharmHub.Matches(charmURL.Schema):
resourceClientGetter = newCharmHubOpener(st)
case charm.CharmStore.Matches(charmURL.Schema):
resourceClientGetter = newCharmStoreOpener(st)
default:
// Use the nop opener that performs no store side requests. Instead it
// will resort to using the state package only. Any thing else will call
Expand Down Expand Up @@ -206,10 +204,6 @@ func (ro ResourceOpener) getResource(resName string, done func()) (_ resources.R
// data from charmhub through a new resourceClient and set the data
// for the resource in the cache.

if res.Origin != charmresource.OriginStore {
return resources.Resource{}, nil, errors.NotFoundf("resource %q", res.Name)
}

id := CharmID{
URL: ro.charmURL,
Origin: ro.charmOrigin,
Expand Down Expand Up @@ -247,7 +241,7 @@ func (ro ResourceOpener) get(name string) (resources.Resource, io.ReadCloser, er
}

res, reader, err := ro.open(name)
if errors.IsNotFound(err) {
if errors.Is(err, errors.NotFound) {
reader = nil
res, err = ro.resourceCache.GetResource(ro.appName, name)
}
Expand Down
2 changes: 1 addition & 1 deletion resource/retryclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func newRetryClient(client ResourceGetter) *ResourceRetryClient {
// (anastasiamac 2017-05-25) This might not work as the error types
// may be lost after a call to some clients.
IsFatalError: func(err error) bool {
return errors.IsNotFound(err) || errors.IsNotValid(err)
return errors.Is(err, errors.NotFound) || errors.Is(err, errors.NotValid)
},
// We don't want to retry for ever.
// If we cannot get a resource after trying a few times,
Expand Down

0 comments on commit 7628d14

Please sign in to comment.