You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/03/06 11:46:19 UTC
[GitHub] [incubator-inlong] LvJiancheng commented on a change in pull request #2948: [INLONG-2908][Agent] Remove the space before the UUID
LvJiancheng commented on a change in pull request #2948:
URL: https://github.com/apache/incubator-inlong/pull/2948#discussion_r820221761
##########
File path: inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/AgentUtils.java
##########
@@ -344,8 +344,19 @@ public static String fetchLocalIp() {
* check agent uuid from manager
*/
public static String fetchLocalUuid() {
- String result = ExcuteLinux.exeCmd("dmidecode | grep UUID");
- return AgentConfiguration.getAgentConf().get(AGENT_LOCAL_UUID, result);
+ String uuid = null;
+ try {
+ String result = ExcuteLinux.exeCmd("dmidecode | grep UUID");
+ if (!StringUtils.isEmpty(result) && StringUtils.containsIgnoreCase(result,"UUID")) {
+ String uuidResult = result.split(":")[1].trim();
+ uuid = AgentConfiguration.getAgentConf().get(AGENT_LOCAL_UUID, uuidResult);
+ return uuid;
+ }
+ } catch (Exception e) {
+ LOGGER.error("fetch uuid error");
+ e.printStackTrace();
+ }
+ return uuid;
Review comment:
ok
##########
File path: inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/AgentUtils.java
##########
@@ -344,8 +344,19 @@ public static String fetchLocalIp() {
* check agent uuid from manager
*/
public static String fetchLocalUuid() {
- String result = ExcuteLinux.exeCmd("dmidecode | grep UUID");
- return AgentConfiguration.getAgentConf().get(AGENT_LOCAL_UUID, result);
+ String uuid = null;
+ try {
+ String result = ExcuteLinux.exeCmd("dmidecode | grep UUID");
+ if (!StringUtils.isEmpty(result) && StringUtils.containsIgnoreCase(result,"UUID")) {
+ String uuidResult = result.split(":")[1].trim();
+ uuid = AgentConfiguration.getAgentConf().get(AGENT_LOCAL_UUID, uuidResult);
Review comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org