本文整理汇总了C++中Oam::distributeConfigFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Oam::distributeConfigFile方法的具体用法?C++ Oam::distributeConfigFile怎么用?C++ Oam::distributeConfigFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oam
的用法示例。
在下文中一共展示了Oam::distributeConfigFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
int c;
string pname(argv[0]);
bool vflg = false;
bool dflg = false;
bool xflg = false;
string configFile;
opterr = 0;
while ((c = getopt(argc, argv, "c:vdxh")) != EOF)
switch (c)
{
case 'v':
vflg = true;
break;
case 'd':
dflg = true;
break;
case 'c':
configFile = optarg;
break;
case 'x':
xflg = true;
break;
case 'h':
case '?':
default:
usage(pname);
return (c == 'h' ? 0 : 1);
break;
}
if ((argc - optind) < 3)
{
usage(pname);
return 1;
}
#ifdef COMMUNITY_KEYRANGE
//No OAM in CE...
dflg = true;
#endif
Oam oam;
oamModuleInfo_t t;
bool parentOAMModuleFlag = true;
string parentOAMModule = " ";
int serverInstallType = oam::INSTALL_COMBINE_DM_UM_PM;
//get local module info; validate running on Active Parent OAM Module
try {
t = oam.getModuleInfo();
parentOAMModuleFlag = boost::get<4>(t);
parentOAMModule = boost::get<3>(t);
serverInstallType = boost::get<5>(t);
}
catch (exception&) {
parentOAMModuleFlag = true;
}
if (!dflg && !parentOAMModuleFlag)
{
cerr << "Exiting, setConfig can only be run on the Active "
"OAM Parent Module '" << parentOAMModule << "'" << endl;
return 2;
}
Config* cf;
if (configFile.length() > 0)
cf = Config::makeConfig(configFile);
else
cf = Config::makeConfig();
if (vflg)
cout << "Using config file: " << cf->configFile() << endl;
if (xflg)
cf->delConfig(argv[optind + 0], argv[optind + 1]);
else
cf->setConfig(argv[optind + 0], argv[optind + 1], argv[optind + 2]);
cf->write();
if (dflg || serverInstallType == oam::INSTALL_COMBINE_DM_UM_PM)
return 0;
//get number of pms
string count = cf->getConfig("PrimitiveServers", "Count");
try {
oam.distributeConfigFile();
//sleep to give time for change to be distributed
sleep(atoi(count.c_str()));
}
catch (...) {
return 1;
}
return 0;
//.........这里部分代码省略.........