From 4d40d60bff5afb1d3d39e4f2f4739f687b3d2927 Mon Sep 17 00:00:00 2001 From: Gianni Carafa Date: Mon, 20 Sep 2021 23:23:33 +0200 Subject: [PATCH] fix locustfiles handling --- app/kubectl.js | 8 +++----- app/locust.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/kubectl.js b/app/kubectl.js index de8ef0f..b64ee5e 100644 --- a/app/kubectl.js +++ b/app/kubectl.js @@ -208,13 +208,11 @@ async function createLocustfile(ns_name, locustfile, content) { chart_configmapLocustfile.metadata.name = locustfile; chart_configmapLocustfile.data = {"main.py": content}; console.log(chart_configmapLocustfile); - returnvalues.locustfile = await CoreV1Api.createNamespacedConfigMap(namespace=ns_name, body=chart_configmapLocustfile); + returnvalues.locustfiles = await CoreV1Api.createNamespacedConfigMap(namespace=ns_name, body=chart_configmapLocustfile); } catch (e) { console.log(e); debug(e); } - console.log('......'); - console.log(returnvalues); return returnvalues; } @@ -224,7 +222,7 @@ async function updateLocustfile(ns_name, locustfile, content) { try { chart_configmapLocustfile.metadata.name = locustfile; chart_configmapLocustfile.data.locustfile = content; - returnvalues.locustfile = await CoreV1Api.replaceNamespacedConfigMap(locustfile, ns_name, chart_configmapLocustfile); + returnvalues.locustfiles = await CoreV1Api.replaceNamespacedConfigMap(locustfile, ns_name, chart_configmapLocustfile); } catch (e) { console.log(e); debug(e); @@ -246,7 +244,7 @@ async function deleteLocustfile(ns_name, locustfile) { returnvalues = {}; try { - returnvalues.locustfile = await CoreV1Api.deleteNamespacedConfigMap(locustfile, ns_name); + returnvalues.locustfiles = await CoreV1Api.deleteNamespacedConfigMap(locustfile, ns_name); } catch (e) { console.log(e); debug(e); diff --git a/app/locust.js b/app/locust.js index 44fa5ba..b2271d4 100644 --- a/app/locust.js +++ b/app/locust.js @@ -126,7 +126,7 @@ async function addLocustfile(namespace, name, locustfile) { async function removeLocustfile(namespace, locustfile) { const result = await kubectl.deleteLocustfile(namespace, locustfile); - if (result.locustfile.response.statusCode == 200) { + if (result.locustfiles.response.statusCode == 200) { delete locust.locustfiles[locustfile]; socket.updatedLocustfiles(locust.locustfiles) console.log(locust);