|
10 | 10 | import codeine.jsons.command.CommandParameterInfo;
|
11 | 11 | import codeine.jsons.global.ExperimentalConfJsonStore;
|
12 | 12 | import codeine.jsons.global.GlobalConfigurationJsonStore;
|
| 13 | +import codeine.jsons.nodes.NodeDiscoveryStrategy; |
13 | 14 | import codeine.jsons.peer_status.PeerStatus;
|
14 | 15 | import codeine.jsons.project.ProjectJson;
|
15 | 16 | import codeine.model.Constants;
|
|
26 | 27 | import com.google.common.collect.Maps;
|
27 | 28 | import java.io.File;
|
28 | 29 | import java.io.PrintWriter;
|
| 30 | +import java.util.ArrayList; |
29 | 31 | import java.util.List;
|
30 | 32 | import java.util.Map;
|
31 | 33 | import java.util.UUID;
|
@@ -151,9 +153,8 @@ private void executeInternal(HttpServletRequest request, HttpServletResponse res
|
151 | 153 | env.put(Constants.EXECUTION_ENV_PROJECT_NAME, commandInfo.project_name());
|
152 | 154 | env.put(Constants.EXECUTION_ENV_NODE_NAME, commandInfo2.node_name());
|
153 | 155 | env.put(Constants.EXECUTION_ENV_NODE_ALIAS, commandInfo2.node_alias());
|
154 |
| - env.put(Constants.EXECUTION_ENV_NODE_TAGS, StringUtils.collectionToString( |
155 |
| - projectStatusUpdater.getTags(commandInfo.project_name(), commandInfo2.node_name()), |
156 |
| - ";")); |
| 156 | + env.put(Constants.EXECUTION_ENV_NODE_TAGS, |
| 157 | + StringUtils.collectionToString(getTags(commandInfo.project_name(), commandInfo2.node_name()),";")); |
157 | 158 | env.put(Constants.EXECUTION_ENV_CODEINE_SERVER,
|
158 | 159 | globalConfigurationJsonStore.get().web_server_host());
|
159 | 160 | env.put(Constants.EXECUTION_ENV_CODEINE_SERVER_PORT,
|
@@ -211,6 +212,21 @@ private Map<String, String> getEnvParams(CommandInfo commandJson) {
|
211 | 212 | return $;
|
212 | 213 | }
|
213 | 214 |
|
| 215 | + private List<String> getTags(String projectName, String nodeName) { |
| 216 | + List<String> tags = new ArrayList<>(); |
| 217 | + ProjectJson projectJson = configurationManager.getProjectForName(projectName); |
| 218 | + if (projectJson.node_discovery_startegy().equals(NodeDiscoveryStrategy.Configuration)) { |
| 219 | + projectJson.nodes_info().stream() |
| 220 | + .filter(n -> n.name().equals(nodeName)) |
| 221 | + .findFirst() |
| 222 | + .ifPresent(n -> tags.addAll(n.tags())); |
| 223 | + } |
| 224 | + else { |
| 225 | + tags.addAll(projectStatusUpdater.getTags(projectName, nodeName)); |
| 226 | + } |
| 227 | + return tags; |
| 228 | + } |
| 229 | + |
214 | 230 | private String encodeIfNeeded(String text, String cred) {
|
215 | 231 | return null == cred ? text : CredHelper.encode(text);
|
216 | 232 | }
|
|
0 commit comments