Skip to content

Commit

Permalink
fix locustfiles handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mms-gianni committed Sep 20, 2021
1 parent 4183bcb commit 4d40d60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions app/kubectl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/locust.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4d40d60

Please sign in to comment.