working commit
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user