diff --git a/cli/cmd/root.go b/cli/cmd/root.go index 561a67bb..7160b9e4 100644 --- a/cli/cmd/root.go +++ b/cli/cmd/root.go @@ -342,7 +342,11 @@ func Execute(rootCmd *cobra.Command, stdin io.Reader, stdout io.Writer, stderr i } if app != nil { - runCmds.appType = app.Scheduler + if app.Scheduler == "native" { + runCmds.appType = "platform" + } else { + runCmds.appType = app.Scheduler + } runCmds.appID = app.ID runCmds.appSlug = app.Slug } diff --git a/client/channel.go b/client/channel.go index d8c49578..6a19957f 100644 --- a/client/channel.go +++ b/client/channel.go @@ -35,7 +35,7 @@ func (c *Client) ListChannels(appID string, appType string, channelName string) return c.KotsClient.ListChannels(appID, channelName) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } func (c *Client) GetChannel(appID string, appType string, channelID string) (*types.Channel, error) { @@ -55,7 +55,7 @@ func (c *Client) GetChannel(appID string, appType string, channelID string) (*ty } else if appType == "kots" { return c.KotsClient.GetChannel(appID, channelID) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } func (c *Client) ArchiveChannel(appID string, appType string, channelID string) error { @@ -64,7 +64,7 @@ func (c *Client) ArchiveChannel(appID string, appType string, channelID string) } else if appType == "kots" { return c.KotsClient.ArchiveChannel(appID, channelID) } - return errors.New("unknown app type") + return errors.Errorf("unknown app type %q", appType) } @@ -82,7 +82,7 @@ func (c *Client) CreateChannel(appID string, appType string, name string, descri return c.KotsClient.ListChannels(appID, name) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } type GetOrCreateChannelOptions struct { @@ -162,5 +162,5 @@ func (c *Client) UpdateSemanticVersioningForChannel(appType string, appID string return err } - return errors.New("unknown app type") + return errors.Errorf("unknown app type %q", appType) } diff --git a/client/collector.go b/client/collector.go index 74249060..2b59c030 100644 --- a/client/collector.go +++ b/client/collector.go @@ -42,5 +42,5 @@ func (c *Client) PromoteCollector(appID string, appType string, specID string, c return c.PlatformClient.PromoteCollector(appID, specID, channelIDs...) } - return errors.New("unknown app type") + return errors.Errorf("unknown app type %q", appType) } diff --git a/client/installer.go b/client/installer.go index e6780d2b..516c03dd 100644 --- a/client/installer.go +++ b/client/installer.go @@ -12,7 +12,7 @@ func (c *Client) CreateInstaller(appId string, appType string, yaml string) (*ty return c.KotsClient.CreateInstaller(appId, yaml) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } func (c *Client) ListInstallers(appId string, appType string) ([]types.InstallerSpec, error) { @@ -23,7 +23,7 @@ func (c *Client) ListInstallers(appId string, appType string) ([]types.Installer return c.KotsClient.ListInstallers(appId) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } @@ -34,6 +34,6 @@ func (c *Client) PromoteInstaller(appId string, appType string, sequence int64, return c.KotsClient.PromoteInstaller(appId, sequence, channelID, versionLabel) } - return errors.New("unknown app type") + return errors.Errorf("unknown app type %q", appType) } diff --git a/client/release.go b/client/release.go index e8c69a52..958a24df 100644 --- a/client/release.go +++ b/client/release.go @@ -1,8 +1,7 @@ package client import ( - "errors" - + "github.com/pkg/errors" "github.com/replicatedhq/replicated/pkg/types" ) @@ -44,7 +43,7 @@ func (c *Client) ListReleases(appID string, appType string) ([]types.ReleaseInfo return c.KotsClient.ListReleases(appID) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } func (c *Client) CreateRelease(appID string, appType string, yaml string) (*types.ReleaseInfo, error) { @@ -78,7 +77,7 @@ func (c *Client) CreateRelease(appID string, appType string, yaml string) (*type return c.KotsClient.CreateRelease(appID, yaml) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } func (c *Client) UpdateRelease(appID string, appType string, sequence int64, yaml string) error { @@ -88,7 +87,7 @@ func (c *Client) UpdateRelease(appID string, appType string, sequence int64, yam } else if appType == "kots" { return c.KotsClient.UpdateRelease(appID, sequence, yaml) } - return errors.New("unknown app type") + return errors.Errorf("unknown app type %q", appType) } func (c *Client) TestRelease(appID string, appType string, sequence int64) (string, error) { @@ -116,7 +115,7 @@ func (c *Client) GetRelease(appID string, appType string, sequence int64) (*type } else if appType == "kots" { return c.KotsClient.GetRelease(appID, sequence) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) } func (c *Client) PromoteRelease(appID string, appType string, sequence int64, label string, notes string, required bool, channelIDs ...string) error { @@ -126,7 +125,7 @@ func (c *Client) PromoteRelease(appID string, appType string, sequence int64, la } else if appType == "kots" { return c.KotsClient.PromoteRelease(appID, sequence, label, notes, required, channelIDs...) } - return errors.New("unknown app type") + return errors.Errorf("unknown app type %q", appType) } // data is a []byte describing a tarred yaml-dir, created by tarYAMLDir() @@ -138,5 +137,5 @@ func (c *Client) LintRelease(appType string, data []byte, isBuildersRelease bool return c.KotsClient.LintRelease(data, isBuildersRelease, contentType) } - return nil, errors.New("unknown app type") + return nil, errors.Errorf("unknown app type %q", appType) }