diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go index 493673ef9..fc8e61940 100644 --- a/pkg/cmd/install.go +++ b/pkg/cmd/install.go @@ -769,6 +769,17 @@ func installCommand() *cli.Command { logrus.Infof("\n sudo ./%s reset\n", binName) return ErrNothingElseToAdd } + + if channelRelease, err := release.GetChannelRelease(); err != nil { + return fmt.Errorf("unable to read channel release data: %w", err) + } else if channelRelease != nil && channelRelease.Airgap && c.String("airgap-bundle") == "" && !c.Bool("no-prompt") { + logrus.Infof("You downloaded an air gap bundle but are performing an online installation.") + logrus.Infof("To do an air gap installation, pass the air gap bundle with --airgap-bundle.") + if !prompts.New().Confirm("Do you want to proceed with an online installation?", false) { + return ErrNothingElseToAdd + } + } + metrics.ReportApplyStarted(c) logrus.Debugf("configuring network manager") if err := configureNetworkManager(c, provider); err != nil { diff --git a/pkg/cmd/join.go b/pkg/cmd/join.go index 80a26490f..0b317e22a 100644 --- a/pkg/cmd/join.go +++ b/pkg/cmd/join.go @@ -31,6 +31,7 @@ import ( "github.com/replicatedhq/embedded-cluster/pkg/metrics" "github.com/replicatedhq/embedded-cluster/pkg/netutils" "github.com/replicatedhq/embedded-cluster/pkg/prompts" + "github.com/replicatedhq/embedded-cluster/pkg/release" "github.com/replicatedhq/embedded-cluster/pkg/spinner" "github.com/replicatedhq/embedded-cluster/pkg/versions" ) @@ -185,6 +186,16 @@ var joinCommand = &cli.Command{ return fmt.Errorf("usage: %s join ", binName) } + if channelRelease, err := release.GetChannelRelease(); err != nil { + return fmt.Errorf("unable to read channel release data: %w", err) + } else if channelRelease != nil && channelRelease.Airgap && c.String("airgap-bundle") == "" && !c.Bool("no-prompt") { + logrus.Infof("You downloaded an air gap bundle but are performing an online join.") + logrus.Infof("To do an air gap join, pass the air gap bundle with --airgap-bundle.") + if !prompts.New().Confirm("Do you want to proceed with an online join?", false) { + return ErrNothingElseToAdd + } + } + logrus.Debugf("fetching join token remotely") jcmd, err := getJoinToken(c.Context, c.Args().Get(0), c.Args().Get(1)) if err != nil { diff --git a/pkg/cmd/restore.go b/pkg/cmd/restore.go index 7dc0a623b..df8a568cd 100644 --- a/pkg/cmd/restore.go +++ b/pkg/cmd/restore.go @@ -959,6 +959,16 @@ func restoreCommand() *cli.Command { return fmt.Errorf("unable to write runtime config: %w", err) } + if channelRelease, err := release.GetChannelRelease(); err != nil { + return fmt.Errorf("unable to read channel release data: %w", err) + } else if channelRelease != nil && channelRelease.Airgap && c.String("airgap-bundle") == "" && !c.Bool("no-prompt") { + logrus.Infof("You downloaded an air gap bundle but are performing an online restore.") + logrus.Infof("To do an air gap restore, pass the air gap bundle with --airgap-bundle.") + if !prompts.New().Confirm("Do you want to proceed with an online restore?", false) { + return ErrNothingElseToAdd + } + } + proxy, err := getProxySpecFromFlags(c) if err != nil { return fmt.Errorf("unable to get proxy spec from flags: %w", err) diff --git a/pkg/release/release.go b/pkg/release/release.go index 8a770d7ba..2092bb9a7 100644 --- a/pkg/release/release.go +++ b/pkg/release/release.go @@ -155,6 +155,7 @@ type ChannelRelease struct { ChannelID string `yaml:"channelID"` ChannelSlug string `yaml:"channelSlug"` AppSlug string `yaml:"appSlug"` + Airgap bool `yaml:"airgap"` } // GetChannelRelease reads the embedded channel release object. If no channel release