예제 #1
0
func execute_list(callList []string, caller command.Executer) (err error) {
	for _, callstring := range callList {

		if err = caller.Execute(ioutil.Discard, callstring); err != nil {
			break
		}
	}
	return
}
예제 #2
0
func executeList(callList []string, caller command.Executer) (err error) {
	for _, callstring := range callList {
		lo.G.Debug(callstring)

		if err = caller.Execute(ioutil.Discard, callstring); err != nil {
			lo.G.Error(err.Error())
			break
		}
	}
	return
}
예제 #3
0
func flushPrivileges(sshConfig command.SshConfig, mysqlAdminPwd string) (err error) {
	var remoteExecuter command.Executer
	var writer io.WriteCloser

	if remoteExecuter, err = NewRemoteExecuter(sshConfig); err == nil {
		writer = os.Stdout
		lo.G.Info("flushing priviledges after restore on ip ->", sshConfig.Host)
		var commandToRun = fmt.Sprintf("/var/vcap/packages/mariadb/bin/mysql -u root -h localhost --password=%s -e 'FLUSH PRIVILEGES'", mysqlAdminPwd)
		err = remoteExecuter.Execute(writer, commandToRun)
		lo.G.Info("Done running flush priviledges on ip ->", sshConfig.Host, err)
	}
	return
}