Refactoring - renaming
This commit is contained in:
parent
5a6ca7e5b6
commit
9543cfd353
@ -16,6 +16,7 @@
|
||||
package org.thingsboard.server.service.edge.instructions;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@ -52,6 +53,7 @@ public class DefaultEdgeInstallInstructionsService implements EdgeInstallInstruc
|
||||
private boolean sslEnabled;
|
||||
|
||||
@Value("${app.version:unknown}")
|
||||
@Setter
|
||||
private String appVersion;
|
||||
|
||||
@Override
|
||||
@ -68,11 +70,6 @@ public class DefaultEdgeInstallInstructionsService implements EdgeInstallInstruc
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateApplicationVersion(String version) {
|
||||
appVersion = version;
|
||||
}
|
||||
|
||||
private EdgeInstructions getDockerInstallInstructions(Edge edge, HttpServletRequest request) {
|
||||
String dockerInstallInstructions = readFile(resolveFile("docker", "instructions.md"));
|
||||
String baseUrl = request.getServerName();
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
package org.thingsboard.server.service.edge.instructions;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@ -48,6 +49,7 @@ public class DefaultEdgeUpgradeInstructionsService implements EdgeUpgradeInstruc
|
||||
private final InstallScripts installScripts;
|
||||
|
||||
@Value("${app.version:unknown}")
|
||||
@Setter
|
||||
private String appVersion;
|
||||
|
||||
@Override
|
||||
@ -65,11 +67,6 @@ public class DefaultEdgeUpgradeInstructionsService implements EdgeUpgradeInstruc
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateApplicationVersion(String version) {
|
||||
appVersion = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInstructionMap(Map<String, EdgeUpgradeInfo> map) {
|
||||
for (String key : map.keySet()) {
|
||||
|
||||
@ -24,5 +24,5 @@ public interface EdgeInstallInstructionsService {
|
||||
|
||||
EdgeInstructions getInstallInstructions(Edge edge, String installationMethod, HttpServletRequest request);
|
||||
|
||||
void updateApplicationVersion(String version);
|
||||
void setAppVersion(String version);
|
||||
}
|
||||
|
||||
@ -26,5 +26,5 @@ public interface EdgeUpgradeInstructionsService {
|
||||
|
||||
void updateInstructionMap(Map<String, EdgeUpgradeInfo> upgradeVersions);
|
||||
|
||||
void updateApplicationVersion(String version);
|
||||
void setAppVersion(String version);
|
||||
}
|
||||
|
||||
@ -155,15 +155,13 @@ public class DefaultUpdateService implements UpdateService {
|
||||
.build());
|
||||
}
|
||||
ObjectNode edgeRequest = JacksonUtil.newObjectNode().put(VERSION_PARAM, version);
|
||||
String prevEdgeInstallVersion = edgeInstallVersion;
|
||||
edgeInstallVersion = restClient.postForObject(UPDATE_SERVER_BASE_URL + "/api/v1/edge/installMapping", new HttpEntity<>(edgeRequest.toString(), headers), String.class);
|
||||
if (edgeInstallVersion != null && !edgeInstallVersion.equals(prevEdgeInstallVersion)) {
|
||||
edgeInstallInstructionsService.updateApplicationVersion(edgeInstallVersion);
|
||||
edgeUpgradeInstructionsService.updateApplicationVersion(edgeInstallVersion);
|
||||
String edgeInstallVersion = restClient.postForObject(UPDATE_SERVER_BASE_URL + "/api/v1/edge/installMapping", new HttpEntity<>(edgeRequest.toString(), headers), String.class);
|
||||
if (edgeInstallVersion != null) {
|
||||
edgeInstallInstructionsService.setAppVersion(edgeInstallVersion);
|
||||
edgeUpgradeInstructionsService.setAppVersion(edgeInstallVersion);
|
||||
}
|
||||
EdgeUpgradeMessage prevEdgeUpgradeMessage = edgeUpgradeMessage;
|
||||
edgeUpgradeMessage = restClient.postForObject(UPDATE_SERVER_BASE_URL + "/api/v1/edge/upgradeMapping", new HttpEntity<>(edgeRequest.toString(), headers), EdgeUpgradeMessage.class);
|
||||
if (edgeUpgradeMessage != null && !edgeUpgradeMessage.equals(prevEdgeUpgradeMessage)) {
|
||||
EdgeUpgradeMessage edgeUpgradeMessage = restClient.postForObject(UPDATE_SERVER_BASE_URL + "/api/v1/edge/upgradeMapping", new HttpEntity<>(edgeRequest.toString(), headers), EdgeUpgradeMessage.class);
|
||||
if (edgeUpgradeMessage != null) {
|
||||
edgeUpgradeInstructionsService.updateInstructionMap(edgeUpgradeMessage.getEdgeVersions());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user