diff --git a/deployment/aeroinfo.go b/deployment/aeroinfo.go index 0157489..5ab0b0e 100644 --- a/deployment/aeroinfo.go +++ b/deployment/aeroinfo.go @@ -61,10 +61,10 @@ func SetMigrateFillDelay(log logr.Logger, policy *aero.ClientPolicy, allHosts [] // SetConfigCommandsOnHosts runs set config command for dynamic config on all the given cluster nodes func SetConfigCommandsOnHosts(log logr.Logger, policy *aero.ClientPolicy, allHosts, selectedHosts []*HostConn, - cmds []string) error { + cmds []string) ([]string, error) { c, err := newCluster(log, policy, allHosts, selectedHosts) if err != nil { - return fmt.Errorf("unable to create a cluster copy for running aeroinfo: %v", err) + return nil, fmt.Errorf("unable to create a cluster copy for running aeroinfo: %v", err) } return c.setConfigCommandsOnHosts(cmds, selectedHosts) diff --git a/deployment/cluster.go b/deployment/cluster.go index 9370630..9c6c2aa 100644 --- a/deployment/cluster.go +++ b/deployment/cluster.go @@ -852,7 +852,7 @@ func (c *cluster) setMigrateFillDelay(migrateFillDelay int, hosts []*HostConn) e cmd := fmt.Sprintf("set-config:context=service;migrate-fill-delay=%d", migrateFillDelay) - if err := c.setConfigCommandsOnHosts([]string{cmd}, hosts); err != nil { + if _, err := c.setConfigCommandsOnHosts([]string{cmd}, hosts); err != nil { return err } @@ -862,8 +862,9 @@ func (c *cluster) setMigrateFillDelay(migrateFillDelay int, hosts []*HostConn) e } // setConfigCommandsOnHosts runs the set-config commands on the hosts. -func (c *cluster) setConfigCommandsOnHosts(cmds []string, hosts []*HostConn) error { +func (c *cluster) setConfigCommandsOnHosts(cmds []string, hosts []*HostConn) ([]string, error) { hostIDs := getHostIDsFromHostConns(hosts) + succeededCmds := make([]string, 0, len(cmds)) log := c.log.WithValues("nodes", hostIDs) log.V(1).Info("Running set-config") @@ -872,26 +873,28 @@ func (c *cluster) setConfigCommandsOnHosts(cmds []string, hosts []*HostConn) err for _, cmd := range cmds { infoResults, iErr := c.infoOnHosts(hostIDs, cmd) if iErr != nil { - return iErr + return succeededCmds, iErr } for id, info := range infoResults { output, err := info.toString(cmd) if err != nil { - return fmt.Errorf( + return succeededCmds, fmt.Errorf( "ServerError: failed to execute set-config command %s on node %s: %v", cmd, id, err) } if !strings.EqualFold(output, "ok") { - return fmt.Errorf("ServerError: failed to execute set-config"+ + return succeededCmds, fmt.Errorf("ServerError: failed to execute set-config"+ " command %s on node %s: %v", cmd, id, output) } } + + succeededCmds = append(succeededCmds, cmd) } log.V(1).Info("Finished running set-config") - return nil + return succeededCmds, nil } func (c *cluster) findHost(hostID string) (*host, error) {