diff --git a/plugin.go b/plugin.go index 4ece835..22b960e 100644 --- a/plugin.go +++ b/plugin.go @@ -257,7 +257,7 @@ func newPlugins() (*plugins, error) { func (p *plugins) print() { if len(p.local) == 0 && len(p.ops) == 0 { debug("No plugins installed") - fmt.Println("No plugins installed. Use 'ops -plugin' to add new ones.") + fmt.Println("No plugins installed. Use ops -plugin to install one.") return } diff --git a/prepare.go b/prepare.go index 489e74a..e084f07 100644 --- a/prepare.go +++ b/prepare.go @@ -223,6 +223,18 @@ func autoCLIUpdate() error { func checkOperatorVersion(opsRootConfig map[string]interface{}) error { trace("checkOperatorVersion") + // --- NEW: Check for active operator installation --- + // Execute "ops debug operator:version" to see if an operator is currently deployed. + debugCmd := exec.Command(os.Getenv("OPS_CMD"), "debug", "operator:version") + output, err := debugCmd.Output() + if err != nil || strings.TrimSpace(string(output)) == "" { + // No operator installed or command failed, so suppress the update suggestion. + debug("No active operator installation detected or command failed:", err, "output:", strings.TrimSpace(string(output))) + return fmt.Errorf("no active operator installation detected") // Return an error to prevent printing the update message + } + debug("Active operator version detected:", strings.TrimSpace(string(output))) + // --- END NEW --- + images := opsRootConfig["images"].(map[string]interface{}) operator := images["operator"].(string) opVer := strings.Split(operator, ":")[1]