diff --git a/main.py b/main.py index 028d9e0..61ff79e 100644 --- a/main.py +++ b/main.py @@ -67,9 +67,8 @@ def get_charts(ns): def sortRevision(n): return n['revision'] -def get_chartdata(tiller_ns, namespace, chart, records): - command = "/usr/local/bin/helm --tiller-namespace " + tiller_ns + " history " + chart + " --max " + records + " --output json" #helm2 - #command = "/usr/local/bin/helm -n " + namespace + " history " + chart + " -ojson" #helm3 +def get_chartdata(namespace, chart, records): + command = "/usr/local/bin/helm -n " + namespace + " history " + chart + " --max " + records + " -ojson" #helm3 info(f"Running command: {command}") try: output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8") @@ -82,11 +81,10 @@ def get_chartdata(tiller_ns, namespace, chart, records): for revision in data: revision['chartName'] = chart revision["namespace"] = namespace - revision["tiller_ns"] = tiller_ns return data -def chartRollback(revision, chart, tiller_ns): - command = "/usr/local/bin/helm --tiller-namespace " + tiller_ns + " rollback " + chart + " " + revision # helm2 +def chartRollback(ns, revision, chart): + command = "/usr/local/bin/helm -n " + ns + " rollback " + chart + " " + revision # helm2 info(f"Running command: {command}") try: output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8") diff --git a/routes/kube_helm_routes.py b/routes/kube_helm_routes.py index 184de81..86147ac 100644 --- a/routes/kube_helm_routes.py +++ b/routes/kube_helm_routes.py @@ -25,9 +25,9 @@ def chartVersions(): return render_template('chartRevisionList.html', table=table) -@routes.route('/nsLookup//') -def namespaceLookup(tiller_ns, namespace): - charts = get_charts(tiller_ns, namespace) +@routes.route('/nsLookup/') +def namespaceLookup(ns): + charts = get_charts(ns) return jsonify(charts) @routes.route('/deployChartRevision///', methods=['POST']) diff --git a/templates/nameChartSelect.html b/templates/nameChartSelect.html index 17a72a4..f47d91c 100644 --- a/templates/nameChartSelect.html +++ b/templates/nameChartSelect.html @@ -59,7 +59,7 @@ ns = nsSelect.value; - fetch('/nsLookup/' + ns + '/default').then(function(response) { + fetch('/nsLookup/' + ns).then(function(response) { response.json().then(function(data) { if (data != 'EMPTY') { var optionHTML = '';