working commit

This commit is contained in:
2026-03-10 12:52:12 +02:00
parent d0a5fab362
commit d1ef1fbe50
42 changed files with 242 additions and 426 deletions
+7 -6
View File
@@ -15,7 +15,7 @@ import (
"github.com/spf13/cobra"
"mstore/pkg/client"
"mstore/pkg/repocli"
)
// DeleteImage
@@ -35,19 +35,20 @@ func (util *ImageUtil) DeleteImage(cmd *cobra.Command, args []string) {
func (util *ImageUtil) deleteImage(common *CommonImageParams, params *DeleteImageParams) (*DeleteImageResult, error) {
var err error
res := &DeleteImageResult{}
ctx := context.Background()
cli := client.NewClient(common.SkipTLSVerify)
timeout := time.Duration(common.Timeout) * time.Second
ctx, _ := context.WithTimeout(context.Background(), timeout)
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
ref, err := repocli.NewReferer(params.Imagepath)
if err != nil {
return res, err
}
ctx, _ = context.WithTimeout(ctx, timeout)
err = cli.DeleteImage(ctx, params.Imagepath)
mw := repocli.NewBasicAuthMiddleware(ref.Userinfo())
cli := repocli.NewClient(nil, mw)
_, err = cli.DeleteImage(ctx, ref.Raw())
if err != nil {
return res, err
}
return res, err
}