|
@@ -1310,32 +1310,39 @@ bool CVtmLoaderFSM::DetectHttpActive()
|
|
|
else
|
|
|
return false;
|
|
|
}
|
|
|
-bool CVtmLoaderFSM::IsRootINIExist()
|
|
|
+bool CVtmLoaderFSM::IsRootINIExist(CSimpleStringA& path)
|
|
|
{
|
|
|
CSimpleStringA csHardwareCfg(true);
|
|
|
ErrorCodeEnum eErr = GetEntityBase()->GetFunction()->GetPath("HardwareCfg", csHardwareCfg);
|
|
|
if (eErr != Error_Succeed)
|
|
|
{
|
|
|
+ path = CSimpleStringA::Format("GetPath of HardwareCfg failed(%d)", eErr);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get path of Run failed:%s", SpStrError(eErr));
|
|
|
- return true;//return true in default
|
|
|
+ return false;
|
|
|
}
|
|
|
- CSimpleStringA csRootINIPath = csHardwareCfg + SPLIT_SLASH_STR + "root.ini";
|
|
|
+ path = csHardwareCfg + SPLIT_SLASH_STR + "root.ini";
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
- if (_access(csRootINIPath.GetData(), 0) == 0) {
|
|
|
+ if (_access(path.GetData(), 0) == 0) {
|
|
|
#else
|
|
|
- if (access(csRootINIPath.GetData(), F_OK) == 0) {
|
|
|
+ if (access(path.GetData(), F_OK) == 0) {
|
|
|
#endif
|
|
|
return true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("root.ini(%s) is not exist.", csRootINIPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("root.ini(%s) is not exist.", path.GetData());
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
bool CVtmLoaderFSM::GetConfig()
|
|
|
{
|
|
|
- //TODO 获取配置
|
|
|
+ //拉取配置前先检查root.ini文件
|
|
|
+ CSimpleStringA csTmpRootIni("");
|
|
|
+ if (!IsRootINIExist(csTmpRootIni))
|
|
|
+ {
|
|
|
+ LogWarn(Severity_High, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("root.ini不存在,请检查(%s)", csTmpRootIni.GetData()));
|
|
|
+ return false;
|
|
|
+ }
|
|
|
ErrorCodeEnum eErr = Error_Succeed;
|
|
|
#ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
|
|
|
CSimpleString channelId = "5fdd82e3b90a4de69f9da4738e5f1216";
|
|
@@ -1494,9 +1501,11 @@ int CVtmLoaderFSM::HttpConnCheck(CSimpleStringA csHttAddr, HttpAddrType eType)
|
|
|
CAutoArray<NetworkAdapterItem> netList;
|
|
|
if (SP::Module::Net::GetINETMacAddresses(netList) == Error_Succeed)
|
|
|
{
|
|
|
+ string tmpDns;
|
|
|
+ GetDns(tmpDns);
|
|
|
for (int i = 0; i < netList.GetCount(); i++) {
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("(%d) interface:%s; ip:%s; mac:%s", i, netList[i].description.c_str()
|
|
|
- , netList[i].ip.c_str(), netList[i].mac.c_str()));
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("(%d)interface:%s; ip:%s; mac:%s; %s", i, netList[i].description.c_str()
|
|
|
+ , netList[i].ip.c_str(), netList[i].mac.c_str(), tmpDns.c_str()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1514,4 +1523,36 @@ int CVtmLoaderFSM::HttpConnCheck(CSimpleStringA csHttAddr, HttpAddrType eType)
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
+}
|
|
|
+void CVtmLoaderFSM::GetDns(string& dns)
|
|
|
+{
|
|
|
+ dns = "";
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
+
|
|
|
+ FILE* stream;
|
|
|
+ char* line = NULL;
|
|
|
+ size_t len = 0;
|
|
|
+ ssize_t read;
|
|
|
+
|
|
|
+ stream = popen("cat /etc/resolv.conf", "r");
|
|
|
+ string tmpStr;
|
|
|
+ while ((read = getline(&line, &len, stream)) != -1)
|
|
|
+ {
|
|
|
+ tmpStr = line;
|
|
|
+ int pos = tmpStr.find("nameserver");
|
|
|
+ if (pos != string::npos)
|
|
|
+ {
|
|
|
+ tmpStr = tmpStr.replace(pos, strlen("nameserver"), "dns");
|
|
|
+ dns += tmpStr + ";";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ int rnPos = dns.find("\n");
|
|
|
+ while (rnPos != string::npos)
|
|
|
+ {
|
|
|
+ dns.replace(rnPos, 1, " ");
|
|
|
+ rnPos = dns.find("\n");
|
|
|
+ }
|
|
|
+#else
|
|
|
+#endif
|
|
|
+ return;
|
|
|
}
|