torequest

package
v8.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TailDiagsLogRelative = "/var/log/trafficserver/diags.log"
	TailRestartTimeOutMS = 60000
	TailReloadTimeOutMS  = 15000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigFile

type ConfigFile struct {
	Name              string // file name
	Dir               string // install directory
	Path              string // full path
	Service           string // service assigned to
	CfgBackup         string // location to backup the config at 'Path'
	TropsBackup       string // location to backup the TrafficOps Version
	AuditComplete     bool   // audit is complete
	AuditFailed       bool   // audit failed
	AuditError        string // Error generated when AuditFailed is true
	ChangeApplied     bool   // a change has been applied
	ChangeNeeded      bool   // change required
	PreReqFailed      bool   // failed plugin prerequiste check
	RemapPluginConfig bool   // file is a remap plugin config file
	Body              []byte
	Perm              os.FileMode // default file permissions
	Uid               int         // owner uid, default is 0
	Gid               int         // owner gid, default is 0
	Warnings          []string
}

type FileRestartData

type FileRestartData struct {
	Name string
	RestartData
}

type Package

type Package struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type RestartData

type RestartData struct {
	TrafficCtlReload     bool // a traffic_ctl_reload is required
	SysCtlReload         bool // a reload of the sysctl.conf is required
	NtpdRestart          bool // ntpd needs restarting
	TeakdRestart         bool // a restart of teakd is required
	TrafficServerRestart bool // a trafficserver restart is required
	RemapConfigReload    bool // remap.config should be reloaded
	HitchReload          bool // hitch should be reloaded
	VarnishReload        bool // varnish should be reloaded
}

type ServerAndConfigs

type ServerAndConfigs struct {
	ConfigData  json.RawMessage
	ConfigFiles json.RawMessage
}

type ShouldReloadRestart

type ShouldReloadRestart struct {
	ReloadRestart []FileRestartData
}

type TrafficOpsReq

type TrafficOpsReq struct {
	Cfg  config.Cfg
	Pkgs map[string]bool // map of packages which are installed, either already installed or newly installed by this run.

	RestartData
	// contains filtered or unexported fields
}

func NewTrafficOpsReq

func NewTrafficOpsReq(cfg config.Cfg) *TrafficOpsReq

NewTrafficOpsReq returns a new TrafficOpsReq object.

func (*TrafficOpsReq) CheckReloadRestart

func (r *TrafficOpsReq) CheckReloadRestart(data []FileRestartData) RestartData

CheckReloadRestart determines the final reload/restart state after all config files are processed.

func (*TrafficOpsReq) CheckRevalidateState

func (r *TrafficOpsReq) CheckRevalidateState(sleepOverride bool) (UpdateStatus, error)

CheckRevalidateState retrieves and returns the revalidate status from Traffic Ops.

func (*TrafficOpsReq) CheckSyncDSState

func (r *TrafficOpsReq) CheckSyncDSState(metaData *t3cutil.ApplyMetaData, cfg config.Cfg) (UpdateStatus, error)

CheckSyncDSState retrieves and returns the DS Update status from Traffic Ops. The metaData is this run's metadata. It must not be nil, and this function may add to it.

func (*TrafficOpsReq) CheckSystemServices

func (r *TrafficOpsReq) CheckSystemServices() error

CheckSystemServices is used to verify that packages installed are enabled for startup.

func (*TrafficOpsReq) DumpConfigFiles

func (r *TrafficOpsReq) DumpConfigFiles()

DumpConfigFiles is used for debugging

func (*TrafficOpsReq) GetConfigFile

func (r *TrafficOpsReq) GetConfigFile(name string) (*ConfigFile, bool)

GetConfigFile fetchs a 'Configfile' by file name.

func (*TrafficOpsReq) GetConfigFileList

func (r *TrafficOpsReq) GetConfigFileList() error

GetConfigFileList fetches and parses the multipart config files for a cache from traffic ops and loads them into the configFiles map.

func (*TrafficOpsReq) IsPackageInstalled

func (r *TrafficOpsReq) IsPackageInstalled(name string) bool

IsPackageInstalled returns true/false if the named rpm package is installed. the prefix before the version is matched.

func (*TrafficOpsReq) PrintWarnings

func (r *TrafficOpsReq) PrintWarnings()

func (*TrafficOpsReq) ProcessConfigFiles

func (r *TrafficOpsReq) ProcessConfigFiles(metaData *t3cutil.ApplyMetaData) (UpdateStatus, error)

ProcessConfigFiles processes all config files retrieved from Traffic Ops.

func (*TrafficOpsReq) ProcessPackages

func (r *TrafficOpsReq) ProcessPackages() error

ProcessPackages retrieves a list of required RPM's from Traffic Ops and determines which need to be installed or removed on the cache.

func (*TrafficOpsReq) ProcessPackagesWithMetaData

func (r *TrafficOpsReq) ProcessPackagesWithMetaData(packageMetaData []string) error

ProcessPackagesWithMetaData will attempt to get installed package data from t3c-apply-metadata.json and log the results.

func (*TrafficOpsReq) RevalidateWhileSleeping

func (r *TrafficOpsReq) RevalidateWhileSleeping(metaData *t3cutil.ApplyMetaData, cfg config.Cfg) (UpdateStatus, error)

func (*TrafficOpsReq) ShowUpdateStatus

func (r *TrafficOpsReq) ShowUpdateStatus(flagType []string, start time.Time, curSetting, newSetting bool)

func (*TrafficOpsReq) StartServices

func (r *TrafficOpsReq) StartServices(syncdsUpdate *UpdateStatus, metaData *t3cutil.ApplyMetaData, cfg config.Cfg) error

StartServices reloads, restarts, or starts ATS as necessary, according to the changed config files and run mode. Returns nil on success or any error.

func (*TrafficOpsReq) UpdateTrafficOps

func (r *TrafficOpsReq) UpdateTrafficOps(syncdsUpdate *UpdateStatus) error

type UpdateStatus

type UpdateStatus int
const (
	UpdateTropsNotNeeded  UpdateStatus = 0
	UpdateTropsNeeded     UpdateStatus = 1
	UpdateTropsSuccessful UpdateStatus = 2
	UpdateTropsFailed     UpdateStatus = 3
)

func (UpdateStatus) String

func (u UpdateStatus) String() string

Jump to

Keyboard shortcuts

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