Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Add configuration option for location of my.cnf file #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Configuration struct {
AvailableLocalSnapshotHostsCommand string // Command which returns list of hosts (one host per line) with available snapshots in local datacenter
AvailableSnapshotHostsCommand string // Command which returns list of hosts (one host per line) with available snapshots in any datacenter
SnapshotVolumesFilter string // text pattern filtering agent logical volumes that are valid snapshots
MySQLConfigFileLocation string // Path to my.cnf (default: /etc/my.cnf)
MySQLDatadirCommand string // command expected to present with @@datadir
MySQLPortCommand string // command expected to present with @@port
MySQLDeleteDatadirContentCommand string // command which deletes all content from MySQL datadir (does not remvoe directory itself)
Expand Down Expand Up @@ -75,6 +76,7 @@ func NewConfiguration() *Configuration {
AvailableLocalSnapshotHostsCommand: "",
AvailableSnapshotHostsCommand: "",
SnapshotVolumesFilter: "",
MySQLConfigFileLocation: "/etc/my.cnf",
MySQLDatadirCommand: "",
MySQLPortCommand: "",
MySQLDeleteDatadirContentCommand: "",
Expand Down
6 changes: 5 additions & 1 deletion go/osagent/osagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,11 @@ func AvailableSnapshots(requireLocal bool) ([]string, error) {
}

func MySQLErrorLogTail() ([]string, error) {
output, err := commandOutput(sudoCmd(`tail -n 20 $(egrep "log[-_]error" /etc/my.cnf | cut -d "=" -f 2)`))
mycnf := config.Config.MySQLConfigFileLocation

command := fmt.Sprintf(`tail -n 20 $(egrep "log[-_]error" %s | cut -d "=" -f 2)`, mycnf)

output, err := commandOutput(sudoCmd(command))
tail, err := outputLines(output, err)
return tail, err
}
Expand Down