@@ -235,7 +235,7 @@ actions:
235235 script: |
236236 function deepCopy(obj) { return toNative(new org.json.JSONObject(String(obj))); }
237237 function applyIf(obj, config) { for (var prop in config) { if (typeof obj[prop] == "undefined" || obj[prop] == null) { obj[prop] = config[prop]; } } return obj; }
238- function schedule(jps, batch, settings) { batch.methods.push({ m : { script: "Install", params: { envName: envName, nodeGroup: nodeGroup, jps: jps, settings: settings || {}, skipEmail: true, tracked: false } } }); }
238+ function schedule(jps, batch, settings, nodeGroup ) { batch.methods.push({ m : { script: "Install", params: { envName: envName, nodeGroup: nodeGroup || "" , jps: jps, settings: settings || {}, skipEmail: true, tracked: false } } }); }
239239 function buildAddon(jps, parent, install) {
240240 var globals = deepCopy(jps.globals || {}); jps.globals = applyIf(globals, deepCopy(parent.globals));
241241 var actions = deepCopy(jps.actions || {}); jps.actions = applyIf(actions, deepCopy(parent.actions));
@@ -247,7 +247,7 @@ actions:
247247 resp = resp.response || resp;
248248 if (resp.result != 0) return resp;
249249
250- var apps = resp.apps, newAddons = {}, mainApp = {}, newJps, nodeGroup ;
250+ var apps = resp.apps, newAddons = {}, mainApp = {}, mainGroup = "k8sm", newJps ;
251251
252252 try {
253253 newJps = toNative(new org.yaml.snakeyaml.Yaml().load(new com.hivext.api.core.utils.Transport().get(manifestUrl)));
@@ -268,35 +268,33 @@ actions:
268268 for (var i = 0, n = apps.length; i < n; i++) {
269269 var app = apps[i], jps;
270270
271- if (!app.isInstalled) continue;
271+ if (!app.isInstalled) continue;
272272 app.settings.data = app.settings.data || {};
273273 app.settings.data.version = version;
274274
275275 if (app.app_id == "kubernetes" || app.app_id == "kubernetes-release") {
276276 mainApp[app.app_id] = { jps: newJps, data: app.settings.data };
277277 } else {
278278 jps = newAddons[app.app_id];
279- nodeGroup = "k8sm";
280279
281280 if (jps) {
282281 jps = buildAddon(jps, newJps);
283282 delete newAddons[app.app_id];
283+
284+ schedule(jps, batch, app.settings.data, mainGroup);
284285 } else {
285286 resp = api.marketplace.jps.Uninstall({ appUniqueName: app.uniqueName, force: true });
286287 if (resp.result != 0) return resp;
287288 }
288289 }
289-
290- if (jps) schedule(jps, batch, app.settings.data);
291290 }
292291
293292 if (mainApp) {
294293 mainApp = mainApp["kubernetes-release"] || mainApp.kubernetes;
295- nodeGroup = "";
296294 schedule(mainApp.jps, batch, mainApp.data);
297295 } else return { result: com.hivext.api.Response.OBJECT_FORMAT_ERROR, error: "Kubernetes manifest is not found!", data: ex};
298296
299- for (var appId in newAddons) schedule(buildAddon(newAddons[appId], newJps, true), batch);
297+ for (var appId in newAddons) schedule(buildAddon(newAddons[appId], newJps, true), batch, null, mainGroup );
300298
301299 if (batch.methods.length > 0) {
302300 var batchResp = api.utils.batch.Call(appid, toJSON(batch), false);
0 commit comments