|
|
@ -103,12 +103,11 @@ func newDependencyCmd(out io.Writer) *cobra.Command {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type dependencyListCmd struct {
|
|
|
|
type dependencyListCmd struct {
|
|
|
|
out io.Writer
|
|
|
|
|
|
|
|
chartpath string
|
|
|
|
chartpath string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func newDependencyListCmd(out io.Writer) *cobra.Command {
|
|
|
|
func newDependencyListCmd(out io.Writer) *cobra.Command {
|
|
|
|
dlc := &dependencyListCmd{out: out}
|
|
|
|
dlc := &dependencyListCmd{}
|
|
|
|
|
|
|
|
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "list [flags] CHART",
|
|
|
|
Use: "list [flags] CHART",
|
|
|
@ -128,7 +127,7 @@ func newDependencyListCmd(out io.Writer) *cobra.Command {
|
|
|
|
return cmd
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (l *dependencyListCmd) run() error {
|
|
|
|
func (l *dependencyListCmd) run(out io.Writer) error {
|
|
|
|
c, err := chartutil.Load(l.chartpath)
|
|
|
|
c, err := chartutil.Load(l.chartpath)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
@ -137,15 +136,15 @@ func (l *dependencyListCmd) run() error {
|
|
|
|
r, err := chartutil.LoadRequirements(c)
|
|
|
|
r, err := chartutil.LoadRequirements(c)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
if err == chartutil.ErrRequirementsNotFound {
|
|
|
|
if err == chartutil.ErrRequirementsNotFound {
|
|
|
|
fmt.Fprintf(l.out, "WARNING: no requirements at %s/charts\n", l.chartpath)
|
|
|
|
fmt.Fprintf(out, "WARNING: no requirements at %s/charts\n", l.chartpath)
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
l.printRequirements(r, l.out)
|
|
|
|
l.printRequirements(out, r)
|
|
|
|
fmt.Fprintln(l.out)
|
|
|
|
fmt.Fprintln(out)
|
|
|
|
l.printMissing(r)
|
|
|
|
l.printMissing(out, r)
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -224,7 +223,7 @@ func (l *dependencyListCmd) dependencyStatus(dep *chartutil.Dependency) string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// printRequirements prints all of the requirements in the yaml file.
|
|
|
|
// printRequirements prints all of the requirements in the yaml file.
|
|
|
|
func (l *dependencyListCmd) printRequirements(reqs *chartutil.Requirements, out io.Writer) {
|
|
|
|
func (l *dependencyListCmd) printRequirements(out io.Writer, reqs *chartutil.Requirements) {
|
|
|
|
table := uitable.New()
|
|
|
|
table := uitable.New()
|
|
|
|
table.MaxColWidth = 80
|
|
|
|
table.MaxColWidth = 80
|
|
|
|
table.AddRow("NAME", "VERSION", "REPOSITORY", "STATUS")
|
|
|
|
table.AddRow("NAME", "VERSION", "REPOSITORY", "STATUS")
|
|
|
@ -235,18 +234,18 @@ func (l *dependencyListCmd) printRequirements(reqs *chartutil.Requirements, out
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// printMissing prints warnings about charts that are present on disk, but are not in the requirements.
|
|
|
|
// printMissing prints warnings about charts that are present on disk, but are not in the requirements.
|
|
|
|
func (l *dependencyListCmd) printMissing(reqs *chartutil.Requirements) {
|
|
|
|
func (l *dependencyListCmd) printMissing(out io.Writer, reqs *chartutil.Requirements) {
|
|
|
|
folder := filepath.Join(l.chartpath, "charts/*")
|
|
|
|
folder := filepath.Join(l.chartpath, "charts/*")
|
|
|
|
files, err := filepath.Glob(folder)
|
|
|
|
files, err := filepath.Glob(folder)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintln(l.out, err)
|
|
|
|
fmt.Fprintln(out, err)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for _, f := range files {
|
|
|
|
for _, f := range files {
|
|
|
|
fi, err := os.Stat(f)
|
|
|
|
fi, err := os.Stat(f)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintf(l.out, "Warning: %s\n", err)
|
|
|
|
fmt.Fprintf(out, "Warning: %s\n", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Skip anything that is not a directory and not a tgz file.
|
|
|
|
// Skip anything that is not a directory and not a tgz file.
|
|
|
|
if !fi.IsDir() && filepath.Ext(f) != ".tgz" {
|
|
|
|
if !fi.IsDir() && filepath.Ext(f) != ".tgz" {
|
|
|
@ -254,7 +253,7 @@ func (l *dependencyListCmd) printMissing(reqs *chartutil.Requirements) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c, err := chartutil.Load(f)
|
|
|
|
c, err := chartutil.Load(f)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintf(l.out, "WARNING: %q is not a chart.\n", f)
|
|
|
|
fmt.Fprintf(out, "WARNING: %q is not a chart.\n", f)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
found := false
|
|
|
|
found := false
|
|
|
@ -265,7 +264,7 @@ func (l *dependencyListCmd) printMissing(reqs *chartutil.Requirements) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !found {
|
|
|
|
if !found {
|
|
|
|
fmt.Fprintf(l.out, "WARNING: %q is not in requirements.yaml.\n", f)
|
|
|
|
fmt.Fprintf(out, "WARNING: %q is not in requirements.yaml.\n", f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|