added skip vetify of server cert
This commit is contained in:
@@ -52,6 +52,7 @@ func (util *ImageUtil) CreateImageCmds() *cobra.Command {
|
||||
subCmd.PersistentFlags().StringVarP(&util.commonImageParams.Username, "user", "u", "", "Username")
|
||||
subCmd.PersistentFlags().StringVarP(&util.commonImageParams.Password, "pass", "p", "", "Password")
|
||||
subCmd.PersistentFlags().Uint64VarP(&util.commonImageParams.Timeout, "timeout", "t", defaultTimeout, "Operation timeout")
|
||||
subCmd.PersistentFlags().BoolVarP(&util.commonImageParams.SkipTLSVerify, "skipVerify", "S", true, "Skip server certificate verify")
|
||||
subCmd.MarkFlagsRequiredTogether("user", "pass")
|
||||
|
||||
vi := viper.New()
|
||||
@@ -109,9 +110,10 @@ type ImageUtil struct {
|
||||
}
|
||||
|
||||
type CommonImageParams struct {
|
||||
Timeout uint64
|
||||
Username string
|
||||
Password string
|
||||
Timeout uint64
|
||||
Username string
|
||||
Password string
|
||||
SkipTLSVerify bool
|
||||
}
|
||||
|
||||
// PushImage
|
||||
@@ -135,7 +137,7 @@ func (util *ImageUtil) pushImage(common *CommonImageParams, params *PushImagePar
|
||||
ctx := context.Background()
|
||||
res := &PushImageResult{}
|
||||
|
||||
cli := client.NewClient()
|
||||
cli := client.NewClient(common.SkipTLSVerify)
|
||||
timeout := time.Duration(common.Timeout) * time.Second
|
||||
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
|
||||
if err != nil {
|
||||
@@ -169,7 +171,7 @@ func (util *ImageUtil) imageInfo(common *CommonImageParams, params *ImageInfoPar
|
||||
res := &ImageInfoResult{}
|
||||
ctx := context.Background()
|
||||
|
||||
cli := client.NewClient()
|
||||
cli := client.NewClient(common.SkipTLSVerify)
|
||||
timeout := time.Duration(common.Timeout) * time.Second
|
||||
|
||||
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
|
||||
@@ -209,7 +211,7 @@ func (util *ImageUtil) pullImage(common *CommonImageParams, params *PullImagePar
|
||||
ctx := context.Background()
|
||||
res := &PullImageResult{}
|
||||
|
||||
cli := client.NewClient()
|
||||
cli := client.NewClient(common.SkipTLSVerify)
|
||||
timeout := time.Duration(common.Timeout) * time.Second
|
||||
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
|
||||
if err != nil {
|
||||
@@ -249,7 +251,7 @@ func (util *ImageUtil) deleteImage(common *CommonImageParams, params *DeleteImag
|
||||
res := &DeleteImageResult{}
|
||||
ctx := context.Background()
|
||||
|
||||
cli := client.NewClient()
|
||||
cli := client.NewClient(common.SkipTLSVerify)
|
||||
timeout := time.Duration(common.Timeout) * time.Second
|
||||
|
||||
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
|
||||
|
||||
Reference in New Issue
Block a user