1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

fix use of the amazon keys

This commit is contained in:
david hill
2016-03-01 14:38:02 -06:00
parent 3eaf5c9aff
commit 71b456438c
10 changed files with 93 additions and 505 deletions

View File

@ -109,9 +109,11 @@ export PATH=$path
export EC2_HOME=$ec2
export JAVA_HOME=$java
# get x509 Certification and Private Key and region
x509Cert=`$prefix/Calpont/bin/getConfig Installation AmazonX509Certificate`
x509PriKey=`$prefix/Calpont/bin/getConfig Installation AmazonX509PrivateKey`
# get Keys and region
AmazonAccessKey=`$prefix/Calpont/bin/getConfig Installation AmazonAccessKey`
AmazonSecretKey=`$prefix/Calpont/bin/getConfig Installation AmazonSecretKey`
AmazonAccessKey=`cat $AmazonAccessKeyFile`
AmazonSecretKey=`cat $AmazonSecretKeyFile`
Region=`$prefix/Calpont/bin/getConfig Installation AmazonRegion`
subnet=`$prefix/Calpont/bin/getConfig Installation AmazonSubNetID`
@ -132,7 +134,7 @@ describeInstanceFile="/tmp/describeInstance.txt"
touch $describeInstanceFile
describeInstance() {
ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region > $describeInstanceFile 2>&1
ec2-describe-instances -O $AmazonAccessKey -W $xAmazonSecretKey --region $Region > $describeInstanceFile 2>&1
}
getInstance() {
@ -145,8 +147,6 @@ getInstance() {
localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'`
#get local Instance ID
# instance=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
if [ "$instance" == "" ]; then
describeInstance
@ -167,8 +167,6 @@ getInstancePrivate() {
localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'`
#get local Instance ID
# instance=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
instance=`cat $describeInstanceFile | grep -m 1 $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
if [ "$instance" == "" ]; then
describeInstance
@ -188,8 +186,6 @@ getZone() {
getInstancePrivate >/dev/null 2>&1
#get zone
if [ "$subnet" == "unassigned" ]; then
# zone=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'`
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'`
if [ "$zone" == "" ]; then
describeInstance
@ -197,8 +193,6 @@ getZone() {
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'`
else
# zone=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'`
zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $10}'`
if [ "$zone" == "" ]; then
describeInstance
@ -214,8 +208,6 @@ getZone() {
getPrivateIP() {
#get instance info
# ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region $instanceName > /tmp/instanceInfo_$instanceName 2>&1
grep -B1 -A4 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1
if [ `cat /tmp/instanceInfo_$instanceName | wc -c` -eq 0 ]; then
describeInstance
@ -265,8 +257,6 @@ getType() {
getInstancePrivate >/dev/null 2>&1
#get Type
if [ "$subnet" == "unassigned" ]; then
# instanceType=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'`
instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'`
if [ "$instanceType" == "" ]; then
describeInstance
@ -274,8 +264,6 @@ getType() {
instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'`
else
# instanceType=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $8}'`
instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $8}'`
if [ "$instanceType" == "" ]; then
describeInstance
@ -293,8 +281,6 @@ getKey() {
getInstancePrivate >/dev/null 2>&1
#get Key
if [ "$subnet" == "unassigned" ]; then
# key=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'`
key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'`
if [ "$key" == "" ]; then
describeInstance
@ -302,8 +288,6 @@ getKey() {
key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'`
else
# key=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'`
key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $6}'`
if [ "$key" == "" ]; then
describeInstance
@ -320,8 +304,6 @@ getAMI() {
#get local Instance ID
getInstancePrivate >/dev/null 2>&1
#get AMI
# ami=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'`
ami=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'`
if [ "$ami" == "" ]; then
describeInstance
@ -337,8 +319,6 @@ getGroup() {
getInstancePrivate >/dev/null 2>&1
#get group
if [ "$subnet" == "unassigned" ]; then
# group=`ec2-describe-instances -C $x509Cert -K $x509PriKey $instance --region $Region | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'`
group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'`
if [ "$group" == "" ]; then
describeInstance
@ -348,8 +328,6 @@ getGroup() {
group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $22}'`
fi
else
# group=`ec2-describe-instances -C $x509Cert -K $x509PriKey $instance --region $Region | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
if [ "$group" == "" ]; then
describeInstance
@ -366,8 +344,6 @@ getProfile() {
getInstancePrivate >/dev/null 2>&1
#get Type
if [ "$subnet" == "unassigned" ]; then
# instanceProfile=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'`
instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'`
if [ "$instanceProfile" == "" ]; then
describeInstance
@ -375,8 +351,6 @@ getProfile() {
instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'`
else
# instanceProfile=`ec2-describe-instances -C $x509Cert -K $x509PriKey --region $Region | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'`
instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'`
if [ "$instanceProfile" == "" ]; then
describeInstance

View File

@ -102,9 +102,12 @@ export PATH=$path
export EC2_HOME=$ec2
export JAVA_HOME=$java
# get x509 Certification and Private Key
x509Cert=`$prefix/Calpont/bin/getConfig Installation AmazonX509Certificate`
x509PriKey=`$prefix/Calpont/bin/getConfig Installation AmazonX509PrivateKey`
# get Keys
AmazonAccessKeyFile=`$prefix/Calpont/bin/getConfig Installation AmazonAccessKey`
AmazonSecretKeyFile=`$prefix/Calpont/bin/getConfig Installation AmazonSecretKey`
AmazonAccessKey=`cat $AmazonAccessKeyFile`
AmazonSecretKey=`cat $AmazonSecretKeyFile`
Region=`$prefix/Calpont/bin/getConfig Installation AmazonRegion`
if test ! -f $x509Cert ; then
@ -171,7 +174,7 @@ createvolume() {
# get zone
zone=`$prefix/Calpont/bin/IDBInstanceCmds.sh getZone`
#create volume
volume=`ec2-create-volume -C $x509Cert -K $x509PriKey --region $Region -z $zone -s $volumeSize | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
volume=`ec2-create-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -z $zone -s $volumeSize | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
# #get volume name
# volume=`cat /tmp/volumeCreate_$resourceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'`
@ -181,7 +184,7 @@ createvolume() {
describevolume() {
#describe volume
ec2-describe-volumes -C $x509Cert -K $x509PriKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1
ec2-describe-volumes -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1
checkInfostatus
echo $STATUS
@ -190,7 +193,7 @@ describevolume() {
detachvolume() {
#detach volume
ec2-detach-volume -C $x509Cert -K $x509PriKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1
ec2-detach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1
checkInfostatus
if [ $STATUS == "detaching" ]; then
@ -227,7 +230,7 @@ detachvolume() {
attachvolume() {
#detach volume
ec2-attach-volume -C $x509Cert -K $x509PriKey --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1
ec2-attach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1
checkInfostatus
if [ $STATUS == "attaching" -o $STATUS == "already-attached" ]; then
@ -261,13 +264,13 @@ attachvolume() {
deletevolume() {
#delete volume
ec2-delete-volume -C $x509Cert -K $x509PriKey --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1
ec2-delete-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1
return
}
createTag() {
#create tag
ec2-create-tags -C $x509Cert -K $x509PriKey --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1
ec2-create-tags -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1
return
}

View File

@ -443,8 +443,8 @@
<SystemLogConfigFile>unassigned</SystemLogConfigFile>
<rpw>unassigned</rpw>
<Cloud>unassigned</Cloud>
<AmazonX509Certificate>unassigned</AmazonX509Certificate>
<AmazonX509PrivateKey>unassigned</AmazonX509PrivateKey>
<AmazonAccessKey>unassigned</AmazonAccessKey>
<AmazonSecretKey>unassigned</AmazonSecretKey>
<AmazonRegion>us-east-1</AmazonRegion>
<AmazonZone>unassigned</AmazonZone>
<AmazonSubNetID>unassigned</AmazonSubNetID>

View File

@ -439,8 +439,8 @@
<Cloud>unassigned</Cloud>
<EEPackageType>rpm</EEPackageType>
<EnableSNMP>y</EnableSNMP>
<AmazonX509Certificate>unassigned</AmazonX509Certificate>
<AmazonX509PrivateKey>unassigned</AmazonX509PrivateKey>
<AmazonAccessKey>unassigned</AmazonAccessKey>
<AmazonSecretKey>unassigned</AmazonSecretKey>
<AmazonRegion>us-east-1</AmazonRegion>
<AmazonZone>unassigned</AmazonZone>
<AmazonSubNetID>unassigned</AmazonSubNetID>

View File

@ -256,30 +256,16 @@
<Arg3>Optional: Module-name and Parameter-name will display the Module Name Configuration parameter</Arg3>
</Cmd38>
<Cmd39>
<Name>addExternalDevice</Name>
<Desc1>Add External Device to Configuration file</Desc1>
<Desc2>External Devices will be monitored and alarms reported on failures</Desc2>
<Arg1>Required: External Device name</Arg1>
<Arg2>Required: External Device IP Address</Arg2>
<Name>AVAILABLE</Name>
</Cmd39>
<Cmd40>
<Name>getExternalDeviceConfig</Name>
<Desc1>Get External Device Configuration Information</Desc1>
<Desc2>Can display all External Device parameters or a single External Device</Desc2>
<Arg1>No Argument or 'all' will display all External Devices Configuration parameters</Arg1>
<Arg2>Optional: External Device name will display the Switch Name Configuration parameters</Arg2>
<Name>AVAILABLE</Name>
</Cmd40>
<Cmd41>
<Name>setExternalDeviceConfig</Name>
<Desc1>Set a External Device Configuration parameter</Desc1>
<Arg1>Required: External-device-name is the parameter to be updated</Arg1>
<Arg2>Required: Parameter-name is the parameter to be updated</Arg2>
<Arg3>Required: Parameter-value is the parameter value</Arg3>
<Name>AVAILABLE</Name>
</Cmd41>
<Cmd42>
<Name>removeExternalDevice</Name>
<Desc1>Remove External Device to Configuration file</Desc1>
<Arg1>Required: External Device name</Arg1>
<Name>AVAILABLE</Name>
</Cmd42>
<Cmd43>
<Name>assignElasticIPAddress</Name>

View File

@ -49,7 +49,6 @@ echo "Create Replication User $repUser for node $hostipaddr" >>/tmp/master-rep-s
cat >/tmp/idb_master-rep.sql <<EOD
CREATE USER '$repUser'@'$hostipaddr' IDENTIFIED BY '$password';
GRANT REPLICATION SLAVE ON *.* TO '$repUser'@'$hostipaddr';
GRANT ALL PRIVILEGES ON *.* TO '$repUser'@'$hostipaddr';
EOD
cat /tmp/idb_master-rep.sql >>/tmp/master-rep-status-$hostipaddr.log
@ -66,7 +65,7 @@ checkForError
echo "Grant table access for $repUser for node $hostipaddr" >>/tmp/master-rep-status-$hostipaddr.log
cat >/tmp/idb_master-rep.sql <<EOD
use mysql
grant all on infinidb_vtable to '$repUser'@'$hostipaddr' identified by 'Calpont1';
grant all on *.* to '$repUser'@'$hostipaddr' identified by 'Calpont1';
grant REPLICATION SLAVE on *.* to '$repUser'@'$hostipaddr' identified by 'Calpont1';
EOD

View File

@ -4103,203 +4103,23 @@ int processCommand(string* arguments)
}
break;
case 39: // addExternalDevice
case 39:
{
ExtDeviceConfig extdeviceconfig;
if (arguments[2] == "")
{
// need 2 arguments
cout << endl << "**** addExternalDevice Failed : Missing a required Parameter, enter 'help' for additional information" << endl;
break;
}
// check if ext device exist
try
{
oam.getSystemConfig(arguments[1], extdeviceconfig);
cout << endl << "**** addExternalDevice Failed : Device already configured" << endl;
break;
}
catch (...)
{
}
extdeviceconfig.Name = arguments[1];
extdeviceconfig.IPAddr = arguments[2];
extdeviceconfig.DisableState = oam::ENABLEDSTATE;
try
{
oam.setSystemConfig(arguments[1], extdeviceconfig);
cout << endl << " Successfully Added: " << arguments[1] << endl << endl;
}
catch (exception& e)
{
cout << endl << "**** addExternalDevice Failed = " << e.what() << endl;
break;
}
catch (...)
{
cout << endl << "**** addExternalDevice Failed" << endl;
break;
}
}
break;
case 40: // getexternaldeviceconfig
case 40:
{
SystemExtDeviceConfig systemextdeviceconfig;
ExtDeviceConfig extdeviceconfig;
systemextdeviceconfig.extdeviceconfig.clear();
string returnValue;
string Argument;
if (arguments[1] == "all" || arguments[1] == "")
{
// get and all display Ext Devices Name config parameters
try
{
oam.getSystemConfig(systemextdeviceconfig);
cout << endl << "External Device Configuration" << endl << endl;
for ( unsigned int i = 0 ; i < systemextdeviceconfig.Count ; i++ )
{
cout << "Name = ";
cout.setf(ios::left);
cout.width(30);
cout << systemextdeviceconfig.extdeviceconfig[i].Name;
cout << "IPAddr = " << systemextdeviceconfig.extdeviceconfig[i].IPAddr << endl;
}
cout << endl;
}
catch (exception& e)
{
cout << endl << "**** getextdeviceconfig Failed = " << e.what() << endl;
}
}
else
{ // get a single ext device name info
try
{
oam.getSystemConfig(arguments[1], extdeviceconfig);
cout << endl << "Name = ";
cout.setf(ios::left);
cout.width(30);
cout << extdeviceconfig.Name;
cout << "IPAddr = " << extdeviceconfig.IPAddr << endl;
cout << endl;
}
catch (...)
{
cout << endl << "**** getextdeviceconfig Failed, invalid device name" << endl;
}
}
}
break;
case 41: // setexternaldeviceconfig - parameters: Ext Device name, Parameter name and value
case 41:
{
ExtDeviceConfig extdeviceconfig;
string Argument;
parentOAMModule = getParentOAMModule();
if ( localModule != parentOAMModule ) {
// exit out since not on Parent OAM Module
cout << endl << "**** setexternaldeviceconfig Failed : only should be run on the Parent OAM Module, which is '" << parentOAMModule << "'" << endl;
break;
}
if (arguments[3] == "")
{
// need 3 arguments
cout << endl << "**** setextdeviceconfig Failed : Missing a required Parameter, enter 'help' for additional information" << endl;
break;
}
if ( arguments[3] == "=" ) {
cout << endl << "**** setextdeviceconfig Failed : Invalid Value of '=', please re-enter" << endl;
break;
}
// check if ext device exist
try
{
oam.getSystemConfig(arguments[1], extdeviceconfig);
}
catch (...)
{
cout << endl << "**** getextdeviceconfig Failed : Invalid device name " << arguments[1] << endl;
break;
}
if ( arguments[2] == "Name" )
extdeviceconfig.Name = arguments[3];
else
if ( arguments[2] == "IPAddr")
extdeviceconfig.IPAddr = arguments[3];
else {
cout << endl << "**** setextdeviceconfig Failed : Invalid Parameter, please re-enter" << endl;
break;
}
try
{
oam.setSystemConfig(arguments[1], extdeviceconfig);
cout << endl << " Successfully set " << arguments[2] << " = " << arguments[3] << endl << endl;
}
catch (...)
{
cout << endl << "**** setextdeviceconfig Failed : Invalid device name " << arguments[1] << endl;
break;
}
}
break;
case 42: // removeExternalDevice
case 42:
{
ExtDeviceConfig extdeviceconfig;
if (arguments[1] == "")
{
// need 1 arguments
cout << endl << "**** removeExternalDevice Failed : Missing a required Parameter, enter 'help' for additional information" << endl;
break;
}
// check if ext device exist
try
{
oam.getSystemConfig(arguments[1], extdeviceconfig);
}
catch (...)
{
cout << endl << "**** removeExternalDevice Failed : Device not configured" << endl;
break;
}
extdeviceconfig.Name = oam::UnassignedName;
extdeviceconfig.IPAddr = oam::UnassignedIpAddr;
try
{
oam.setSystemConfig(arguments[1], extdeviceconfig);
cout << endl << " Successfully removed: " << arguments[1] << endl << endl;
}
catch (exception& e)
{
cout << endl << "**** removeExternalDevice Failed = " << e.what() << endl;
break;
}
catch (...)
{
cout << endl << "**** removeExternalDevice Failed" << endl;
break;
}
}
break;

View File

@ -106,12 +106,12 @@ bool createDbrootDirs(string DBRootStorageType);
bool pkgCheck();
bool storageSetup(string cloud);
void setSystemName();
bool checkInstanceRunning(string instanceName, string x509Cert, string x509PriKey);
string getInstanceIP(string instanceName, string x509Cert, string x509PriKey);
bool checkInstanceRunning(string instanceName, string AmazonAccessKey, string AmazonSecretKey);
string getInstanceIP(string instanceName, string AmazonAccessKey, string AmazonSecretKey);
bool attachVolume(string instanceName, string volumeName, string deviceName, string dbrootPath);
bool singleServerDBrootSetup();
bool copyFstab(string moduleName);
bool copyX509files();
bool copyKeyfiles();
void remoteInstallThread(void *);
@ -145,8 +145,8 @@ bool thread_remote_installer = true;
string singleServerInstall = "1";
string reuseConfig ="n";
string oldFileName;
string x509Cert;
string x509PriKey;
string AmazonAccessKey;
string AmazonSecretKey;
string glusterCopies;
string glusterInstalled = "n";
string hadoopInstalled = "n";
@ -981,8 +981,8 @@ int main(int argc, char *argv[])
{
cout << endl << "For Amazon EC2/VPC Instance installs, these files will need to be installed on" << endl;
cout << "on the local instance:" << endl << endl;
cout << " 1. X.509 Certificate" << endl;
cout << " 2. X.509 Private Key" << endl << endl;
cout << " 1. File containing the Amazon Access Key" << endl;
cout << " 2. File containing the Amazon Secret Key" << endl << endl;
while(true) {
string ready = "y";
@ -1006,8 +1006,8 @@ int main(int argc, char *argv[])
}
try {
x509Cert = sysConfig->getConfig(InstallSection, "AmazonX509Certificate");
x509PriKey = sysConfig->getConfig(InstallSection, "AmazonX509PrivateKey");
AmazonAccessKey = sysConfig->getConfig(InstallSection, "AmazonAccessKey");
AmazonSecretKey = sysConfig->getConfig(InstallSection, "AmazonSecretKey");
}
catch(...)
{}
@ -1016,13 +1016,13 @@ int main(int argc, char *argv[])
while(true)
{
prompt = "Enter Name and directory of the X.509 Certificate (" + x509Cert + ") > ";
prompt = "Enter file name containing the Access Key (" + AmazonAccessKey + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand) {
if (strlen(pcommand) > 0) x509Cert = pcommand;
if (strlen(pcommand) > 0) AmazonAccessKey = pcommand;
callFree(pcommand);
}
ifstream File (x509Cert.c_str());
ifstream File (AmazonAccessKey.c_str());
if (!File) {
cout << "Error: file not found, please re-enter" << endl;
if ( noPrompting )
@ -1034,13 +1034,13 @@ int main(int argc, char *argv[])
while(true)
{
prompt = "Enter Name and directory of the X.509 Private Key (" + x509PriKey + ") > ";
prompt = "Enter file name containing the Secret Key (" + AmazonSecretKey + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand) {
if (strlen(pcommand) > 0) x509PriKey = pcommand;
if (strlen(pcommand) > 0) AmazonSecretKey = pcommand;
callFree(pcommand);
}
ifstream File (x509PriKey.c_str());
ifstream File (AmazonSecretKey.c_str());
if (!File)
{
cout << "Error: file not found, please re-enter" << endl;
@ -1052,15 +1052,40 @@ int main(int argc, char *argv[])
}
try {
sysConfig->setConfig(InstallSection, "AmazonX509Certificate", x509Cert);
sysConfig->setConfig(InstallSection, "AmazonX509PrivateKey", x509PriKey);
sysConfig->setConfig(InstallSection, "AmazonAccessKey", AmazonAccessKey);
sysConfig->setConfig(InstallSection, "AmazonSecretKey", AmazonSecretKey);
}
catch(...)
{}
if( !copyX509files() )
cout << "copyX509files error" << endl;
if( !copyKeyfiles() )
cout << "copyKeyfiles error" << endl;
try {
AmazonRegion = sysConfig->getConfig(InstallSection, "AmazonRegion");
}
catch(...)
{}
cout << endl;
while(true)
{
prompt = "Enter Amazon Region you are running in (" + AmazonRegion + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand) {
if (strlen(pcommand) > 0) AmazonRegion = pcommand;
callFree(pcommand);
}
break;
}
try {
sysConfig->setConfig(InstallSection, "AmazonRegion", AmazonRegion);
}
catch(...)
{}
break;
}
}
@ -2552,239 +2577,6 @@ int main(int argc, char *argv[])
//check snmp Apps disable option
snmpAppCheck();
//
// Configure External Devices
//
SystemExtDeviceConfig systemextdeviceconfig;
try{
oam.getSystemConfig(systemextdeviceconfig);
}
catch(...)
{
cout << "ERROR: Problem reading the InfiniDB System Configuration file" << endl;
exit(1);
}
cout << endl << "===== Setup the External Device Configuration =====" << endl << endl;
cout << "External Devices are devices like a storage array or a Ethernet Switch that can" << endl;
cout << "be setup to be monitored by InfiniDB with a ping test. If device fails, InfiniDB" << endl;
cout << "will report a failure alarm." << endl << endl;
if ( systemextdeviceconfig.Count > 0 ) {
cout << "Current List of External Devices being monitored" << endl << endl;
cout << "Device Name IP Address" << endl;
cout << "-------------------------- ----------------" << endl;
for ( unsigned int i = 0 ; i < systemextdeviceconfig.Count ; i++ )
{
cout.setf(ios::left);
cout.width(30);
cout << systemextdeviceconfig.extdeviceconfig[i].Name;
cout << systemextdeviceconfig.extdeviceconfig[i].IPAddr << endl;
// cout << "Device Name: " << (*pt1).Name << " IP Address: " << (*pt1).IPAddr << endl;
}
cout << endl;
string modify = "n";
while(true) {
prompt = "Would you like to modify current list? [y,n] (n) > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) modify = pcommand;
callFree(pcommand);
}
if ( modify == "y" || modify == "n" )
break;
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
if ( noPrompting )
exit(1);
}
if ( modify == "y" ) {
for ( unsigned int i = 0 ; i < systemextdeviceconfig.Count ; i++ )
{
string name = systemextdeviceconfig.extdeviceconfig[i].Name;
modify = "n";
while(true) {
prompt = "Would you like to modify or delete '" + name + "'? [m,d,n] (n) > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) modify = pcommand;
callFree(pcommand);
}
if ( modify == "m" || modify == "d" || modify == "n")
break;
cout << "Invalid Entry, please enter 'm' for modify, 'd' for delete or 'n' for no" << endl;
if ( noPrompting )
exit(1);
}
if ( modify == "d" ) {
// delete device
ExtDeviceConfig extdeviceconfig;
extdeviceconfig.Name = oam::UnassignedName;
extdeviceconfig.IPAddr = oam::UnassignedIpAddr;
extdeviceconfig.DisableState = oam::ENABLEDSTATE;
try{
oam.setSystemConfig(name, extdeviceconfig);
}
catch(...)
{
cout << "ERROR: Problem updating the InfiniDB System Configuration file" << endl;
exit(1);
}
cout << "External Device '" + name + "' deleted" << endl << endl;
}
else
{
if ( modify == "m" ) {
string newName = name;
prompt = "Enter Name (" + newName + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) newName = pcommand;
callFree(pcommand);
}
string newIPAddr = systemextdeviceconfig.extdeviceconfig[i].IPAddr;
while (true)
{
prompt = "Enter IP Address of (" + newIPAddr + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) newIPAddr = pcommand;
callFree(pcommand);
}
if (oam.isValidIP(newIPAddr))
break;
else
{
cout << "Invalid IP Address format, xxx.xxx.xxx.xxx, please re-enter" << endl;
if ( noPrompting )
exit(1);
}
}
ExtDeviceConfig extdeviceconfig;
extdeviceconfig.Name = newName;
extdeviceconfig.IPAddr = newIPAddr;
extdeviceconfig.DisableState = oam::ENABLEDSTATE;
try{
oam.setSystemConfig(name, extdeviceconfig);
}
catch(...)
{
cout << "ERROR: Problem updating the InfiniDB System Configuration file" << endl;
exit(1);
}
cout << "External Device '" + name + "' modified" << endl << endl;
}
}
}
}
}
while(true) {
string add = "n";
while(true) {
prompt = "Would you like to add an External Device? [y,n] (n) > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) add = pcommand;
callFree(pcommand);
}
if ( add == "y" || add == "n" )
break;
cout << "Invalid Entry, please enter 'y' for yes or 'n' for no" << endl;
if ( noPrompting )
exit(1);
}
if ( add == "y" ) {
cout << endl;
string newName = oam::UnassignedName;
while(true) {
prompt = "Enter Name (" + newName + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) newName = pcommand;
callFree(pcommand);
}
if ( newName == oam::UnassignedName ) {
cout << "Invalid Entry, please enter valid name or 'abort'" << endl;
if ( noPrompting )
exit(1);
}
else
break;
}
if ( newName == "abort" )
continue;
//get Network IP Address
string newIPAddr = oam::UnassignedIpAddr;
string IPAddress = oam.getIPAddress(newName);
if ( !IPAddress.empty() )
newIPAddr = IPAddress;
while (true)
{
prompt = "Enter IP Address of (" + newIPAddr + ") > ";
pcommand = callReadline(prompt.c_str());
if (pcommand)
{
if (strlen(pcommand) > 0) newIPAddr = pcommand;
callFree(pcommand);
}
if (oam.isValidIP(newIPAddr))
break;
else
cout << "Invalid IP Address format, xxx.xxx.xxx.xxx, please re-enter" << endl;
if ( noPrompting )
exit(1);
newIPAddr = oam::UnassignedIpAddr;
}
ExtDeviceConfig extdeviceconfig;
extdeviceconfig.Name = newName;
extdeviceconfig.IPAddr = newIPAddr;
extdeviceconfig.DisableState = oam::ENABLEDSTATE;
try{
oam.setSystemConfig(newName, extdeviceconfig);
}
catch(...)
{
cout << "ERROR: Problem updating the InfiniDB System Configuration file" << endl;
exit(1);
}
cout << endl;
}
else
break;
}
//setup local OS Files
if( !setOSFiles(parentOAMModuleName, IserverTypeInstall) ) {
cout << "setOSFiles error" << endl;
@ -5031,12 +4823,12 @@ bool copyFstab(string moduleName)
/*
* Copy x.509 file
*/
bool copyX509files()
bool copyKeyfiles()
{
string cmd = "/bin/cp -f " + x509Cert + " " + installDir + "/local/etc/. > /dev/null 2>&1";
string cmd = "/bin/cp -f " + AmazonAccessKey + " " + installDir + "/local/etc/. > /dev/null 2>&1";
system(cmd.c_str());
cmd = "/bin/cp -f " + x509PriKey + " " + installDir + "/local/etc/. > /dev/null 2>&1";
cmd = "/bin/cp -f " + AmazonSecretKey + " " + installDir + "/local/etc/. > /dev/null 2>&1";
system(cmd.c_str());
return true;

View File

@ -10069,7 +10069,20 @@ int ProcessManager::setMySQLReplication(oam::DeviceNetworkList devicenetworklist
if ( moduleType == "pm" && PMwithUM == "n" )
continue;
}
//check status, skip if module is offline
int opState = oam::ACTIVE;
bool degraded;
try {
oam.getModuleStatus(remoteModuleName, opState, degraded);
}
catch(...)
{
}
if (opState != oam::ACTIVE)
continue;
ByteStream msg1;
ByteStream::byte requestID = oam::SLAVEREP;
if ( !enable ) {

View File

@ -843,6 +843,7 @@ void ProcessMonitor::processMessage(messageqcpp::ByteStream msg, messageqcpp::IO
//stop the mysql daemon
try {
oam.actionMysqlCalpont(MYSQL_STOP);
log.writeLog(__LINE__, "Stop MySQL Process", LOG_TYPE_DEBUG);
}
catch(...)
{}