diff --git a/cmd/helm/home.go b/cmd/helm/home.go index fce35ab2a..78d3473f1 100644 --- a/cmd/helm/home.go +++ b/cmd/helm/home.go @@ -15,13 +15,13 @@ var homeCommand = &cobra.Command{ Use: "home", Short: "Displays the location of HELM_HOME", Long: longHomeHelp, - Run: Home, + Run: home, } func init() { RootCommand.AddCommand(homeCommand) } -func Home(cmd *cobra.Command, args []string) { +func home(cmd *cobra.Command, args []string) { cmd.Printf(os.ExpandEnv(helmHome) + "\n") } diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 5155c6724..0d08dcc19 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -32,16 +32,16 @@ var initCmd = &cobra.Command{ Use: "init", Short: "Initialize Helm on both client and server.", Long: installDesc, - RunE: RunInit, + RunE: runInit, } -// RunInit initializes local config and installs tiller to Kubernetes Cluster -func RunInit(cmd *cobra.Command, args []string) error { +// runInit initializes local config and installs tiller to Kubernetes Cluster +func runInit(cmd *cobra.Command, args []string) error { if len(args) != 0 { return errors.New("This command does not accept arguments. \n") } - if err := EnsureHome(os.ExpandEnv(helmHome)); err != nil { + if err := ensureHome(os.ExpandEnv(helmHome)); err != nil { return err } @@ -75,11 +75,11 @@ func buildKubectlRunner(kubectlPath string) kubectl.Runner { return &kubectl.RealRunner{} } -// EnsureHome checks to see if $HELM_HOME exists +// ensureHome checks to see if $HELM_HOME exists // // If $HELM_HOME does not exist, this function will create it. -func EnsureHome(home string) error { - configDirectories := []string{home, CacheDirectory(home)} +func ensureHome(home string) error { + configDirectories := []string{home, cacheDirectory(home)} for _, p := range configDirectories { if fi, err := os.Stat(p); err != nil { @@ -88,26 +88,26 @@ func EnsureHome(home string) error { return fmt.Errorf("Could not create %s: %s", p, err) } } else if !fi.IsDir() { - return fmt.Errorf("%s must be a directory.", p) + return fmt.Errorf("%s must be a directory", p) } } - repoPath := RepositoriesFile(home) + repoPath := repositoriesFile(home) if fi, err := os.Stat(repoPath); err != nil { fmt.Printf("Creating %s \n", repoPath) if err := ioutil.WriteFile(repoPath, []byte("test-charts: https://www.googleapis.com/storage/v1/b/test-charts/o\n"), 0644); err != nil { return err } } else if fi.IsDir() { - return fmt.Errorf("%s must be a file, not a directory.", repoPath) + return fmt.Errorf("%s must be a file, not a directory", repoPath) } return nil } -func CacheDirectory(home string) string { +func cacheDirectory(home string) string { return filepath.Join(home, cachePath) } -func RepositoriesFile(home string) string { +func repositoriesFile(home string) string { return filepath.Join(home, repositoriesPath) } diff --git a/cmd/tiller/tiller.go b/cmd/tiller/tiller.go index 6e420d1ef..d53d220ba 100644 --- a/cmd/tiller/tiller.go +++ b/cmd/tiller/tiller.go @@ -13,7 +13,7 @@ import ( // rootServer is the root gRPC server. // // Each gRPC service registers itself to this server during init(). -var rootServer *grpc.Server = grpc.NewServer() +var rootServer = grpc.NewServer() var env = environment.New() const globalUsage = `The Kubernetes Helm server. diff --git a/pkg/chart/values.go b/pkg/chart/values.go index 8c1c1200d..20a712dc3 100644 --- a/pkg/chart/values.go +++ b/pkg/chart/values.go @@ -8,8 +8,10 @@ import ( "github.com/BurntSushi/toml" ) +// ErrNoTable indicates that a chart does not have a matching table. var ErrNoTable = errors.New("no table") +// Values represents a collection of chart values. type Values map[string]interface{} // Table gets a table (TOML subsection) from a Values object. diff --git a/pkg/storage/memory.go b/pkg/storage/memory.go index 55ce53366..28bf62495 100644 --- a/pkg/storage/memory.go +++ b/pkg/storage/memory.go @@ -11,12 +11,14 @@ type Memory struct { releases map[string]*release.Release } +// NewMemory creates a new in-memory storage. func NewMemory() *Memory { return &Memory{ releases: map[string]*release.Release{}, } } +// ErrNotFound indicates that a release is not found. var ErrNotFound = errors.New("release not found") // Read returns the named Release. @@ -36,12 +38,10 @@ func (m *Memory) Create(rel *release.Release) error { return nil } -var ErrNoRelease = errors.New("no release found") - // Update sets a release. func (m *Memory) Update(rel *release.Release) error { if _, ok := m.releases[rel.Name]; !ok { - return ErrNoRelease + return ErrNotFound } // FIXME: When Release is done, we need to do this right by marking the old @@ -50,16 +50,17 @@ func (m *Memory) Update(rel *release.Release) error { return nil } +// Delete removes a release. func (m *Memory) Delete(name string) (*release.Release, error) { rel, ok := m.releases[name] if !ok { - return nil, ErrNoRelease + return nil, ErrNotFound } delete(m.releases, name) return rel, nil } -// List returns all releases +// List returns all releases. func (m *Memory) List() ([]*release.Release, error) { buf := make([]*release.Release, len(m.releases)) i := 0 @@ -69,6 +70,8 @@ func (m *Memory) List() ([]*release.Release, error) { } return buf, nil } + +// Query searches all releases for matches. func (m *Memory) Query(labels map[string]string) ([]*release.Release, error) { return []*release.Release{}, errors.New("Cannot implement until release.Release is defined.") }