Commit bc4bb79f authored by Matt Butcher's avatar Matt Butcher

feat(cli): added back 'helm release'

This re-adds the top level Helm command that sends a packaged helm chart
to the server. This existed in an earlier draft of the Helm-DM client,
but it fell through the cracks when we re-organized the helm commands.
parent 187f6e05
...@@ -53,12 +53,19 @@ func pack(cxt *cli.Context) error { ...@@ -53,12 +53,19 @@ func pack(cxt *cli.Context) error {
return fmt.Errorf("Not a directory: %s", dir) return fmt.Errorf("Not a directory: %s", dir)
} }
c, err := chart.LoadDir(dir) fname, err := packDir(dir)
if err != nil { if err != nil {
return fmt.Errorf("Failed to load %s: %s", dir, err) return err
} }
fname, err := chart.Save(c, ".")
format.Msg(fname) format.Msg(fname)
return nil return nil
} }
func packDir(dir string) (string, error) {
c, err := chart.LoadDir(dir)
if err != nil {
return "", fmt.Errorf("Failed to load %s: %s", dir, err)
}
return chart.Save(c, ".")
}
...@@ -17,7 +17,11 @@ limitations under the License. ...@@ -17,7 +17,11 @@ limitations under the License.
package main package main
import ( import (
"errors"
"os"
"github.com/codegangsta/cli" "github.com/codegangsta/cli"
"github.com/kubernetes/deployment-manager/pkg/format"
) )
func init() { func init() {
...@@ -35,5 +39,30 @@ func releaseCmd() cli.Command { ...@@ -35,5 +39,30 @@ func releaseCmd() cli.Command {
Usage: "Destination URL to which this will be POSTed.", Usage: "Destination URL to which this will be POSTed.",
}, },
}, },
Action: func(c *cli.Context) { run(c, release) },
}
}
func release(c *cli.Context) error {
a := c.Args()
if len(a) == 0 {
return errors.New("'helm release' requires a path to a chart archive or directory.")
} }
var arch string
if fi, err := os.Stat(a[0]); err != nil {
return err
} else if fi.IsDir() {
var err error
arch, err = packDir(a[0])
if err != nil {
return err
}
} else {
arch = a[0]
}
u, err := NewClient(c).PostChart(arch, arch)
format.Msg(u)
return err
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment