migratorv4

package
v0.0.0-...-f54f16c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLEANUP_ID                    = "clean_up"
	SKIP_MIGRATION_PERMANENTLY_ID = "skip_migration"
)
View Source
const (
	SPACES_BEFORE_STEPS          = "       "
	AUTOMATE_VERSION_4    string = "4"
	SPINNER_TEST_DURATION        = 100 * time.Millisecond
)
View Source
const (
	MINIMUM_SHARD_VALUE                   = 1500
	MAX_OPEN_FILE_DEFAULT                 = "65535"
	MAX_LOCKED_MEM_DEFAULT                = "unlimited"
	MAX_OPEN_FILE_KEY                     = "Max open files"
	MAX_LOCKED_MEM_KEY                    = "Max locked memory"
	INDICES_BREAKER_TOTAL_LIMIT_DEFAULT   = "95%"
	INDICES_TOTAL_SHARD_INCREMENT_DEFAULT = 1000
	MAX_POSSIBLE_HEAP_SIZE                = 32
	ELASTICSEARCH_DATA_DIR                = "/svc/automate-elasticsearch/data"
	ELASTICSEARCH_VAR_DIR                 = "/svc/automate-elasticsearch/var"
	OPENSEARCH_DATA_DIR                   = "/svc/automate-opensearch/data"
	MIGRATE_ES_ID                         = "migrate_es"
)
View Source
const (
	FSCRIPT = `` /* 414-byte string literal not displayed */

)
View Source
const (
	MIGRATION_TERMINATED = "Migration Terminated."
)

Variables

View Source
var SPINNER_TIMEOUT = 100 * time.Millisecond

Functions

func NewMigratorV4

func NewMigratorV4(writer *cli.Writer, migratorUtils MigratorV4Utils, fileutils fileutils.FileUtils, timeout int64, spinnerTimeout time.Duration) migrator.Migrator

Types

type AutomateStop

type AutomateStop struct {
	// contains filtered or unexported fields
}

func NewAutomateStop

func NewAutomateStop(w *cli.Writer, utils MigratorV4Utils, healthStatus *bool, spinnerTimeout time.Duration) *AutomateStop

func (*AutomateStop) DefferedHandler

func (as *AutomateStop) DefferedHandler() error

func (*AutomateStop) ErrorHandler

func (as *AutomateStop) ErrorHandler()

func (*AutomateStop) Run

func (as *AutomateStop) Run() (err error)

type CheckDirExists

type CheckDirExists struct {
	// contains filtered or unexported fields
}

func NewCheckDirExists

func NewCheckDirExists(w *cli.Writer, fileutils fileutils.FileUtils) *CheckDirExists

func (*CheckDirExists) ErrorHandler

func (cde *CheckDirExists) ErrorHandler()

func (*CheckDirExists) Run

func (cde *CheckDirExists) Run() error

type CheckStorage

type CheckStorage struct {
	// contains filtered or unexported fields
}

func NewCheckStorage

func NewCheckStorage(w *cli.Writer, utils MigratorV4Utils, fileutils fileutils.FileUtils) *CheckStorage

func (*CheckStorage) ErrorHandler

func (cs *CheckStorage) ErrorHandler()

func (*CheckStorage) Run

func (cs *CheckStorage) Run() error

type Cleanup

type Cleanup struct {
	// contains filtered or unexported fields
}

func NewCleanUp

func NewCleanUp(w *cli.Writer, utils MigratorV4Utils, fileutils fileutils.FileUtils, autoAccept, forceExecute bool, spinnerTimeout time.Duration) *Cleanup

func (*Cleanup) Clean

func (cu *Cleanup) Clean(skipConfirmation bool) error

type ESSettings

type ESSettings struct {
	TotalShardSettings       int32  `json:"totalShardSettings" toml:"totalShardSettings"`
	IndicesBreakerTotalLimit string `json:"indicesBreakerTotalLimit" toml:"indicesBreakerTotalLimit"`
	RuntimeMaxOpenFile       string `json:"runtimeMaxOpenFile" toml:"runtimeMaxOpenFile"`
	RuntimeMaxLockedMem      string `json:"runtimeMaxLockedMem" toml:"runtimeMaxLockedMem"`
	HeapMemory               string `json:"heapMemory" toml:"heapMemory"`
}

type EnableMaintenance

type EnableMaintenance struct {
	// contains filtered or unexported fields
}

func NewEnableMaintenance

func NewEnableMaintenance(w *cli.Writer, utils MigratorV4Utils, timeout int64, spinnerTimeout time.Duration) *EnableMaintenance

func (*EnableMaintenance) ErrorHandler

func (em *EnableMaintenance) ErrorHandler()

func (*EnableMaintenance) OnSuccess

func (em *EnableMaintenance) OnSuccess() (err error)

func (*EnableMaintenance) Run

func (em *EnableMaintenance) Run() (err error)

type EnsureStatusInspection

type EnsureStatusInspection struct {
	// contains filtered or unexported fields
}

func NewEnsureStatus

func NewEnsureStatus(w *cli.Writer, migratorUtils MigratorV4Utils) *EnsureStatusInspection

func (*EnsureStatusInspection) ErrorHandler

func (es *EnsureStatusInspection) ErrorHandler()

func (*EnsureStatusInspection) Run

func (es *EnsureStatusInspection) Run() (err error)

type MigrationScript

type MigrationScript struct {
	// contains filtered or unexported fields
}

func NewMigrationScript

func NewMigrationScript(w *cli.Writer, utils MigratorV4Utils, fileutils fileutils.FileUtils, spinnerTimeout time.Duration) *MigrationScript

func (*MigrationScript) ErrorHandler

func (ms *MigrationScript) ErrorHandler()

func (*MigrationScript) Run

func (ms *MigrationScript) Run() error

type MigratorV4

type MigratorV4 struct {
	// contains filtered or unexported fields
}

func (*MigratorV4) AddDefaultMigrationSteps

func (m *MigratorV4) AddDefaultMigrationSteps()

func (*MigratorV4) AddMigrationSteps

func (m *MigratorV4) AddMigrationSteps(migrationSteps migrator.MigrationSteps)

func (*MigratorV4) AskForConfirmation

func (m *MigratorV4) AskForConfirmation(skipConfirmation bool) error

func (*MigratorV4) ClearData

func (m *MigratorV4) ClearData() error

func (*MigratorV4) ExecuteDeferredSteps

func (m *MigratorV4) ExecuteDeferredSteps() error

func (*MigratorV4) ExecuteMigrationSteps

func (m *MigratorV4) ExecuteMigrationSteps() (err error)

func (*MigratorV4) IsExecutedCheck

func (m *MigratorV4) IsExecutedCheck() error

func (*MigratorV4) IsMigrationPermanentlySkipped

func (m *MigratorV4) IsMigrationPermanentlySkipped() (bool, error)

func (*MigratorV4) PrintMigrationErrors

func (m *MigratorV4) PrintMigrationErrors()

func (*MigratorV4) RunMigrationFlow

func (m *MigratorV4) RunMigrationFlow(skipConfirmation bool)

func (*MigratorV4) RunSuccess

func (m *MigratorV4) RunSuccess() error

func (*MigratorV4) SaveExecutedStatus

func (m *MigratorV4) SaveExecutedStatus() error

func (*MigratorV4) SkipMigrationPermanently

func (m *MigratorV4) SkipMigrationPermanently() error

type MigratorV4Utils

type MigratorV4Utils interface {
	GetEsTotalShardSettings(path string) (int32, error)
	PatchOpensearchConfig(es *ESSettings) (string, string, error)
	IsExternalElasticSearch(timeout int64) bool
	StopAutomate() error
	StartAutomate() error
	ReadV4Checklist(id, path string) (bool, error)
	UpdatePostChecklistFile(id, path string) error
	ExecuteCommand(command string, args []string, workingDir string) error
	GetServicesStatus() (bool, error)
	GetAutomateFQDN(timeout int64) string
	GetMaintenanceStatus(timeout int64) (bool, error)
	SetMaintenanceMode(timeout int64, status bool) (stdOut, stdErr string, err error)
}

func NewMigratorV4Utils

func NewMigratorV4Utils() MigratorV4Utils

type MigratorV4UtilsImpl

type MigratorV4UtilsImpl struct {
}

func (*MigratorV4UtilsImpl) ExecuteCommand

func (m *MigratorV4UtilsImpl) ExecuteCommand(command string, args []string, workingDir string) error

func (*MigratorV4UtilsImpl) GetAutomateFQDN

func (m *MigratorV4UtilsImpl) GetAutomateFQDN(timeout int64) string

func (*MigratorV4UtilsImpl) GetEsTotalShardSettings

func (m *MigratorV4UtilsImpl) GetEsTotalShardSettings(path string) (int32, error)

func (*MigratorV4UtilsImpl) GetMaintenanceStatus

func (m *MigratorV4UtilsImpl) GetMaintenanceStatus(timeout int64) (bool, error)

func (*MigratorV4UtilsImpl) GetServicesStatus

func (m *MigratorV4UtilsImpl) GetServicesStatus() (bool, error)

func (*MigratorV4UtilsImpl) IsExternalElasticSearch

func (m *MigratorV4UtilsImpl) IsExternalElasticSearch(timeout int64) bool

func (*MigratorV4UtilsImpl) PatchOpensearchConfig

func (m *MigratorV4UtilsImpl) PatchOpensearchConfig(osConfig *ESSettings) (string, string, error)

func (*MigratorV4UtilsImpl) ReadV4Checklist

func (m *MigratorV4UtilsImpl) ReadV4Checklist(id, path string) (bool, error)

func (*MigratorV4UtilsImpl) SetMaintenanceMode

func (m *MigratorV4UtilsImpl) SetMaintenanceMode(timeout int64, status bool) (stdOut, stdErr string, err error)

func (*MigratorV4UtilsImpl) StartAutomate

func (m *MigratorV4UtilsImpl) StartAutomate() error

func (*MigratorV4UtilsImpl) StopAutomate

func (m *MigratorV4UtilsImpl) StopAutomate() error

func (*MigratorV4UtilsImpl) UpdatePostChecklistFile

func (m *MigratorV4UtilsImpl) UpdatePostChecklistFile(id, path string) error

type MockMigratorV4UtilsImpl

type MockMigratorV4UtilsImpl struct {
	GetEsTotalShardSettingsFunc func(path string) (int32, error)
	PatchOpensearchConfigFunc   func(es *ESSettings) (string, string, error)
	IsExternalElasticSearchFunc func(timeout int64) bool
	StopAutomateFunc            func() error
	StartAutomateFunc           func() error
	ReadV4ChecklistFunc         func(id, path string) (bool, error)
	UpdatePostChecklistFileFunc func(id, path string) error
	ExecuteCommandFunc          func(command string, args []string, workingDir string) error
	GetServicesStatusFunc       func() (bool, error)
	CreateMigrateJsonFunc       func() error
	GetAutomateFQDNFunc         func(timeout int64) string
	GetMaintenanceStatusFunc    func(timeout int64) (bool, error)
	SetMaintenanceModeFunc      func(timeout int64, status bool) (stdOut, stdErr string, err error)
}

func (*MockMigratorV4UtilsImpl) CreateMigrateJson

func (mui *MockMigratorV4UtilsImpl) CreateMigrateJson() error

func (*MockMigratorV4UtilsImpl) ExecuteCommand

func (mui *MockMigratorV4UtilsImpl) ExecuteCommand(command string, args []string, workingDir string) error

func (*MockMigratorV4UtilsImpl) GetAutomateFQDN

func (mui *MockMigratorV4UtilsImpl) GetAutomateFQDN(timeout int64) string

func (*MockMigratorV4UtilsImpl) GetEsTotalShardSettings

func (mui *MockMigratorV4UtilsImpl) GetEsTotalShardSettings(path string) (int32, error)

func (*MockMigratorV4UtilsImpl) GetMaintenanceStatus

func (mui *MockMigratorV4UtilsImpl) GetMaintenanceStatus(timeout int64) (bool, error)

func (*MockMigratorV4UtilsImpl) GetServicesStatus

func (mui *MockMigratorV4UtilsImpl) GetServicesStatus() (bool, error)

func (*MockMigratorV4UtilsImpl) IsExternalElasticSearch

func (mui *MockMigratorV4UtilsImpl) IsExternalElasticSearch(timeout int64) bool

func (*MockMigratorV4UtilsImpl) PatchOpensearchConfig

func (mui *MockMigratorV4UtilsImpl) PatchOpensearchConfig(es *ESSettings) (string, string, error)

func (*MockMigratorV4UtilsImpl) ReadV4Checklist

func (mui *MockMigratorV4UtilsImpl) ReadV4Checklist(id, path string) (bool, error)

func (*MockMigratorV4UtilsImpl) SetMaintenanceMode

func (mui *MockMigratorV4UtilsImpl) SetMaintenanceMode(timeout int64, status bool) (stdOut, stdErr string, err error)

func (*MockMigratorV4UtilsImpl) StartAutomate

func (mui *MockMigratorV4UtilsImpl) StartAutomate() error

func (*MockMigratorV4UtilsImpl) StopAutomate

func (mui *MockMigratorV4UtilsImpl) StopAutomate() error

func (*MockMigratorV4UtilsImpl) UpdatePostChecklistFile

func (mui *MockMigratorV4UtilsImpl) UpdatePostChecklistFile(id, path string) error

type PatchOpensearchConfig

type PatchOpensearchConfig struct {
	// contains filtered or unexported fields
}

func NewPatchOpensearchConfig

func NewPatchOpensearchConfig(w *cli.Writer, utils MigratorV4Utils, fileutils fileutils.FileUtils, spinnerTimeout time.Duration) *PatchOpensearchConfig

func (*PatchOpensearchConfig) ErrorHandler

func (poc *PatchOpensearchConfig) ErrorHandler()

func (*PatchOpensearchConfig) GetDefaultOpensearchSettings

func (poc *PatchOpensearchConfig) GetDefaultOpensearchSettings() *ESSettings

func (*PatchOpensearchConfig) Run

func (poc *PatchOpensearchConfig) Run() error

type WaitForHealthy

type WaitForHealthy struct {
	// contains filtered or unexported fields
}

func NewWaitForHealthy

func NewWaitForHealthy(writer *cli.Writer, utils MigratorV4Utils, healthStatus *bool, spinnerTimeout time.Duration) *WaitForHealthy

func (*WaitForHealthy) DefferedHandler

func (wfh *WaitForHealthy) DefferedHandler() error

func (*WaitForHealthy) ErrorHandler

func (wfh *WaitForHealthy) ErrorHandler()

func (*WaitForHealthy) Run

func (wfh *WaitForHealthy) Run() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL