diff --git a/commands/cmd_list_all_nodes.go b/commands/cmd_list_all_nodes.go index d0bfb23..68e7cc7 100644 --- a/commands/cmd_list_all_nodes.go +++ b/commands/cmd_list_all_nodes.go @@ -21,6 +21,7 @@ import ( "github.com/spf13/cobra" "github.com/vertica/vcluster/vclusterops" + "github.com/vertica/vcluster/vclusterops/util" "github.com/vertica/vcluster/vclusterops/vlog" ) @@ -101,6 +102,18 @@ func (c *CmdListAllNodes) validateParse(logger vlog.Printer) error { func (c *CmdListAllNodes) Run(vcc vclusterops.ClusterCommands) error { vcc.V(1).Info("Called method Run()") + c.fetchNodeStateOptions.SandboxedNodesOnly = true + dbConfig, configErr := readConfig() + if configErr != nil { + c.fetchNodeStateOptions.SandboxedNodesOnly = false + vcc.DisplayWarning("Failed to read the configuration file", "error", configErr) + } else { + for _, n := range dbConfig.Nodes { + if n.Sandbox == util.MainClusterSandbox { + c.fetchNodeStateOptions.SandboxedNodesOnly = false + } + } + } nodeStates, err := vcc.VFetchNodeState(c.fetchNodeStateOptions) if err != nil { diff --git a/commands/cmd_revive_db.go b/commands/cmd_revive_db.go index 63126af..f759398 100644 --- a/commands/cmd_revive_db.go +++ b/commands/cmd_revive_db.go @@ -164,6 +164,14 @@ func (c *CmdReviveDB) validateParse(logger vlog.Printer) error { } } + if c.reviveDBOptions.Sandbox != "" && c.reviveDBOptions.MainCluster { + return fmt.Errorf("sandbox and main_cluster_only are mutually exclusive") + } + + if c.reviveDBOptions.Sandbox == "" && !c.reviveDBOptions.MainCluster { + logger.DisplayWarning("neither --sandbox nor --main_cluster_only option is specified, proceeding to revive to main cluster") + } + // when --display-only is provided, we do not need to parse some base options like hostListStr if c.reviveDBOptions.DisplayOnly { return nil