1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

when setting systemName also modify my.cnf to update server_audit_syslog_info value.

This commit is contained in:
Ben Thompson
2017-04-06 11:47:54 -05:00
parent 3e85b6ef07
commit 8aa37589b5
3 changed files with 35 additions and 12 deletions

View File

@ -8336,7 +8336,7 @@ namespace oam
/****************************************************************************************** /******************************************************************************************
* @brief changeMyCnf * @brief changeMyCnf
* *
* purpose: change my.cnf * purpose: change my.cnf and add if value is not present
* *
******************************************************************************************/ ******************************************************************************************/
bool Oam::changeMyCnf( std::string paramater, std::string value ) bool Oam::changeMyCnf( std::string paramater, std::string value )
@ -8351,24 +8351,39 @@ namespace oam
vector <string> lines; vector <string> lines;
char line[200]; char line[200];
string buf; string buf;
bool foundIt = false;
while (file.getline(line, 200)) while (file.getline(line, 200))
{ {
buf = line; buf = line;
// change port string::size_type pos = buf.find(paramater,0);
if ( paramater == "port" ) if ( pos == 0 ) {
{ string::size_type pos = buf.find("=",0);
string::size_type pos = buf.find(paramater,0); if ( pos != string::npos )
if ( pos == 0 ) { buf = paramater + " = " + value;
string::size_type pos = buf.find("=",0); foundIt = true;
if ( pos != string::npos )
buf = "port = " + value;
}
} }
//output to temp file //output to temp file
lines.push_back(buf); lines.push_back(buf);
} }
if (!foundIt)
{
// Back to beginning of file
file.clear();
file.seekg(0, ios::beg);
lines.clear();
while (file.getline(line, 200))
{
buf = line;
string::size_type pos = buf.find("[mysqld]",0);
if ( pos != string::npos ) {
lines.push_back(buf);
buf = paramater + " = " + value;
}
//output to temp file
lines.push_back(buf);
}
}
file.close(); file.close();
unlink (mycnfFile.c_str()); unlink (mycnfFile.c_str());
ofstream newFile (mycnfFile.c_str()); ofstream newFile (mycnfFile.c_str());

View File

@ -4858,6 +4858,7 @@ bool storageSetup(bool amazonInstall)
void setSystemName() void setSystemName()
{ {
Oam oam;
//setup System Name //setup System Name
try { try {
systemName = sysConfig->getConfig(SystemSection, "SystemName"); systemName = sysConfig->getConfig(SystemSection, "SystemName");
@ -4880,6 +4881,7 @@ void setSystemName()
try { try {
sysConfig->setConfig(SystemSection, "SystemName", systemName); sysConfig->setConfig(SystemSection, "SystemName", systemName);
oam.changeMyCnf( "server_audit_syslog_info", systemName );
} }
catch(...) catch(...)
{ {

View File

@ -129,7 +129,13 @@ int main(int argc, char** argv)
if (xflg) if (xflg)
cf->delConfig(argv[optind + 0], argv[optind + 1]); cf->delConfig(argv[optind + 0], argv[optind + 1]);
else else
{
cf->setConfig(argv[optind + 0], argv[optind + 1], argv[optind + 2]); cf->setConfig(argv[optind + 0], argv[optind + 1], argv[optind + 2]);
if (strcmp(argv[optind + 1],"SystemName") == 0)
{
oam.changeMyCnf( "server_audit_syslog_info", argv[optind + 2] );
}
}
cf->write(); cf->write();
if (dflg || serverInstallType == oam::INSTALL_COMBINE_DM_UM_PM) if (dflg || serverInstallType == oam::INSTALL_COMBINE_DM_UM_PM)