Skip to content

Commit 4245450

Browse files
committed
codex comments
Signed-off-by: Arnab Chatterjee <arnabchat2001@gmail.com>
1 parent 028898a commit 4245450

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

pkg/kit/auth.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ func Login(ctx context.Context, opts *LoginOptions) error {
4545
if err != nil {
4646
return err
4747
}
48-
reg, err := remote.NewRegistry(opts.Registry, &opts.NetworkOptions)
48+
networkOpts := opts.NetworkOptions
49+
if networkOpts.CredentialsPath == "" {
50+
networkOpts.CredentialsPath = credentialsStorePath
51+
if !networkOpts.PlainHTTP && !networkOpts.TLSVerify {
52+
networkOpts.TLSVerify = true
53+
}
54+
}
55+
reg, err := remote.NewRegistry(opts.Registry, &networkOpts)
4956
if err != nil {
5057
return fmt.Errorf("could not resolve registry %s: %w", opts.Registry, err)
5158
}

pkg/kit/pull.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,22 @@ type PullResult struct {
4747
}
4848

4949
func Pull(ctx context.Context, opts *PullOptions) (*PullResult, error) {
50-
storageHome := constants.StoragePath(opts.ConfigHome)
51-
localRepo, err := local.NewLocalRepo(storageHome, opts.ModelRef)
50+
pullOpts := *opts
51+
if pullOpts.NetworkOptions.Concurrency < 1 {
52+
pullOpts.NetworkOptions.Concurrency = 5
53+
}
54+
if pullOpts.NetworkOptions.CredentialsPath == "" {
55+
pullOpts.NetworkOptions.CredentialsPath = constants.CredentialsPath(pullOpts.ConfigHome)
56+
if !pullOpts.NetworkOptions.PlainHTTP && !pullOpts.NetworkOptions.TLSVerify {
57+
pullOpts.NetworkOptions.TLSVerify = true
58+
}
59+
}
60+
storageHome := constants.StoragePath(pullOpts.ConfigHome)
61+
localRepo, err := local.NewLocalRepo(storageHome, pullOpts.ModelRef)
5262
if err != nil {
5363
return nil, err
5464
}
55-
desc, err := runPullRecursive(ctx, localRepo, opts, []string{})
65+
desc, err := runPullRecursive(ctx, localRepo, &pullOpts, []string{})
5666
if err != nil {
5767
return nil, err
5868
}

0 commit comments

Comments
 (0)