Skip to content

Commit

Permalink
containerapi: add deprecation notices
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Jan 22, 2025
1 parent ac99bb2 commit 4862693
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rhel/internal/containerapi/containerapi.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Package containerapi is a minimal client around the Red Hat Container API.
//
// Deprecated: This package's functionality should only be required for
// container images that are long-since out of support.
package containerapi

import (
Expand All @@ -10,6 +13,7 @@ import (
"net/url"
"path"
"strings"
"sync"

"github.com/quay/zlog"
)
Expand Down Expand Up @@ -38,6 +42,13 @@ type ContainerAPI struct {

// GetCPEs fetches CPE information for given build from Red Hat Container API.
func (c *ContainerAPI) GetCPEs(ctx context.Context, nvr, arch string) ([]string, error) {
deprecationWarning.Do(func() {
zlog.Warn(ctx).
Bool("deprecation", true).
Msg("support for the Red Hat Container API will be removed in a future release")
zlog.Warn(ctx).
Msg("container images using this code are extremely old!")
})
uri, err := c.Root.Parse(path.Join("v1/images/nvr/", nvr))
if err != nil {
return nil, err
Expand Down Expand Up @@ -80,3 +91,5 @@ func (c *ContainerAPI) GetCPEs(ctx context.Context, nvr, arch string) ([]string,
}
return nil, nil
}

var deprecationWarning sync.Once

0 comments on commit 4862693

Please sign in to comment.