mv untar to pkg/manager

Signed-off-by: Weiping Cai <weiping.cai@daocloud.io>
pull/8499/head
Weiping Cai 5 years ago
parent c7abc018c2
commit 7e5182e30c
No known key found for this signature in database
GPG Key ID: 97CBE6D7C8EBC386

@ -17,14 +17,12 @@ package main
import (
"io"
"os"
"path/filepath"
"github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/downloader"
"helm.sh/helm/v3/pkg/getter"
)
@ -69,28 +67,12 @@ func newDependencyUpdateCmd(cfg *action.Configuration, out io.Writer) *cobra.Com
RepositoryConfig: settings.RepositoryConfig,
RepositoryCache: settings.RepositoryCache,
Debug: settings.Debug,
Untar: client.Untar,
}
if client.Verify {
man.Verify = downloader.VerifyAlways
}
err := man.Update()
if err != nil {
return err
}
if client.Untar {
match := chartpath + "/charts/*.tgz"
files, err := filepath.Glob(match)
if err != nil {
return err
}
for _, f := range files {
chartutil.ExpandFile(chartpath+"/charts/", f)
os.Remove(f)
}
}
return nil
return man.Update()
},
}

@ -76,6 +76,7 @@ type Manager struct {
RegistryClient *registry.Client
RepositoryConfig string
RepositoryCache string
Untar bool
}
// Build rebuilds a local charts directory from a lockfile.
@ -357,6 +358,11 @@ func (m *Manager) downloadAll(deps []*chart.Dependency) error {
break
}
if m.Untar {
chartutil.ExpandFile(m.ChartPath+"/charts/", destfile)
os.Remove(destfile)
}
churls[churl] = struct{}{}
}

Loading…
Cancel
Save