filecli, filecmd: added uploading as helm chart
This commit is contained in:
@@ -29,6 +29,7 @@ type ImportFilesParams struct {
|
||||
Source string
|
||||
Dest string
|
||||
Progress bool
|
||||
Chart bool
|
||||
}
|
||||
type ImportFilesResult struct {
|
||||
Files []string `json:"files,omitempty"`
|
||||
@@ -69,8 +70,6 @@ func (util *FileUtil) importFiles(common *CommonFileParams, params *ImportFilesP
|
||||
return nil
|
||||
}
|
||||
ref.JoinResource(relpath)
|
||||
//fmt.Printf("====%s %s\n", relpath, ref.Raw())
|
||||
//return nil
|
||||
file, err := os.OpenFile(walkpath, os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
putErrors = append(putErrors, err)
|
||||
@@ -89,7 +88,11 @@ func (util *FileUtil) importFiles(common *CommonFileParams, params *ImportFilesP
|
||||
mw := filecli.NewBasicAuthMiddleware(ref.Userinfo())
|
||||
|
||||
cli := filecli.NewClient(nil, mw)
|
||||
err = cli.PutFile(ctx, ref.Raw(), file, stat.Size())
|
||||
mime := defMediaType
|
||||
if params.Chart {
|
||||
mime = hcMediaType
|
||||
}
|
||||
err = cli.PutFile(ctx, ref.Raw(), mime, file, stat.Size())
|
||||
if err != nil {
|
||||
putErrors = append(putErrors, err)
|
||||
fmt.Printf("- %s: error: %v \n", ref.Raw(), err)
|
||||
|
||||
Reference in New Issue
Block a user