func (a *actionCleanoutMember) CheckProgress(ctx context.Context) (bool, bool, error) {
	log := a.log
	m, ok := a.actionCtx.GetMemberStatusByID(a.action.MemberID)
	if !ok {
		return true, false, nil
	}
	if !m.IsInitialized {
		return true, false, nil
	}
	ctxChild, cancel := context.WithTimeout(ctx, arangod.GetRequestTimeout())
	defer cancel()
	c, err := a.actionCtx.GetDatabaseClient(ctxChild)
	if err != nil {
		log.Debug().Err(err).Msg("Failed to create database client")
		return false, false, nil
	}
	ctxChild, cancel = context.WithTimeout(ctx, arangod.GetRequestTimeout())
	defer cancel()
	cluster, err := c.Cluster(ctxChild)
	if err != nil {
		log.Debug().Err(err).Msg("Failed to access cluster")
		return false, false, nil
	}
	ctxChild, cancel = context.WithTimeout(ctx, arangod.GetRequestTimeout())
	defer cancel()
	cleanedOut, err := cluster.IsCleanedOut(ctxChild, a.action.MemberID)
	if err != nil {
		log.Debug().Err(err).Msg("IsCleanedOut failed")
		return false, false, nil
	}
	if !cleanedOut {
		log.Debug().Msg("IsCleanedOut returned false")
		ctxChild, cancel = context.WithTimeout(ctx, arangod.GetRequestTimeout())
		defer cancel()
		c, err := a.actionCtx.GetDatabaseClient(ctxChild)
		if err != nil {
			log.Debug().Err(err).Msg("Failed to create database client")
			return false, false, nil
		}
		ctxChild, cancel = context.WithTimeout(ctx, arangod.GetRequestTimeout())
		defer cancel()
		agency, err := a.actionCtx.GetAgency(ctxChild)
		if err != nil {
			log.Debug().Err(err).Msg("Failed to create agency client")
			return false, false, nil
		}
		ctxChild, cancel = context.WithTimeout(ctx, arangod.GetRequestTimeout())
		defer cancel()
		jobStatus, err := arangod.CleanoutServerJobStatus(ctxChild, m.CleanoutJobID, c, agency)
		if err != nil {
			log.Debug().Err(err).Msg("Failed to fetch cleanout job status")
			return false, false, nil
		}
		if jobStatus.IsFailed() {
			log.Warn().Str("reason", jobStatus.Reason()).Msg("Cleanout Job failed. Aborting plan")
			m.Phase = api.MemberPhaseCreated
			m.CleanoutJobID = ""
			if err := a.actionCtx.UpdateMember(ctx, m); err != nil {
				return false, false, errors.WithStack(err)
			}
			return false, true, nil
		}
		return false, false, nil
	}
	if m.Conditions.Update(api.ConditionTypeCleanedOut, true, "CleanedOut", "") {
		if err := a.actionCtx.UpdateMember(ctx, m); err != nil {
			return false, false, errors.WithStack(err)
		}
	}
	return true, false, nil
}
CheckProgress checks the progress of the action.
Returns: ready, abort, error.
package reconcile
import (
	"context"
	"github.com/arangodb/kube-arangodb/pkg/util/errors"
	driver "github.com/arangodb/go-driver"
	api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
	"github.com/rs/zerolog"
	"github.com/arangodb/kube-arangodb/pkg/util/arangod"
)
func init() {
	registerAction(api.ActionTypeCleanOutMember, newCleanOutMemberAction)
}
func newCleanOutMemberAction(log zerolog.Logger, action api.Action, actionCtx ActionContext) Action {
	a := &actionCleanoutMember{}
	a.actionImpl = newActionImplDefRef(log, action, actionCtx, cleanoutMemberTimeout)
	return a
}
type actionCleanoutMember struct {
	actionImpl
}
func (a *actionCleanoutMember) Start(ctx context.Context) (bool, error) {
	if a.action.Group != api.ServerGroupDBServers {
		return true, nil
	}
	m, ok := a.actionCtx.GetMemberStatusByID(a.action.MemberID)
	if !ok {
		return true, nil
	}
	log := a.log
	ctxChild, cancel := context.WithTimeout(ctx, arangod.GetRequestTimeout())
	defer cancel()
	c, err := a.actionCtx.GetDatabaseClient(ctxChild)
	if err != nil {
		log.Debug().Err(err).Msg("Failed to create member client")
		return false, errors.WithStack(err)
	}
	ctxChild, cancel = context.WithTimeout(ctx, arangod.GetRequestTimeout())
	defer cancel()
	cluster, err := c.Cluster(ctxChild)
	if err != nil {
		log.Debug().Err(err).Msg("Failed to access cluster")
		return false, errors.WithStack(err)
	}
	ctxChild, cancel = context.WithTimeout(ctx, arangod.GetRequestTimeout())
	defer cancel()
	var jobID string
	ctxJobID := driver.WithJobIDResponse(ctxChild, &jobID)
	if err := cluster.CleanOutServer(ctxJobID, a.action.MemberID); err != nil {
		if driver.IsNotFound(err) {
			return true, nil
		}
		log.Debug().Err(err).Msg("Failed to cleanout member")
		return false, errors.WithStack(err)
	}
	log.Debug().Str("job-id", jobID).Msg("Cleanout member started")
	m.Phase = api.MemberPhaseCleanOut
	m.CleanoutJobID = jobID
	if a.actionCtx.UpdateMember(ctx, m); err != nil {
		return false, errors.WithStack(err)
	}
	return false, nil
}