Fix namespace lookup code
This commit is contained in:
parent
665afb5183
commit
b59e2d73a2
10
main.py
10
main.py
@ -67,9 +67,8 @@ def get_charts(ns):
|
|||||||
def sortRevision(n):
|
def sortRevision(n):
|
||||||
return n['revision']
|
return n['revision']
|
||||||
|
|
||||||
def get_chartdata(tiller_ns, namespace, chart, records):
|
def get_chartdata(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 + " --max " + records + " -ojson" #helm3
|
||||||
#command = "/usr/local/bin/helm -n " + namespace + " history " + chart + " -ojson" #helm3
|
|
||||||
info(f"Running command: {command}")
|
info(f"Running command: {command}")
|
||||||
try:
|
try:
|
||||||
output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8")
|
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:
|
for revision in data:
|
||||||
revision['chartName'] = chart
|
revision['chartName'] = chart
|
||||||
revision["namespace"] = namespace
|
revision["namespace"] = namespace
|
||||||
revision["tiller_ns"] = tiller_ns
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def chartRollback(revision, chart, tiller_ns):
|
def chartRollback(ns, revision, chart):
|
||||||
command = "/usr/local/bin/helm --tiller-namespace " + tiller_ns + " rollback " + chart + " " + revision # helm2
|
command = "/usr/local/bin/helm -n " + ns + " rollback " + chart + " " + revision # helm2
|
||||||
info(f"Running command: {command}")
|
info(f"Running command: {command}")
|
||||||
try:
|
try:
|
||||||
output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8")
|
output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8")
|
||||||
|
|||||||
@ -25,9 +25,9 @@ def chartVersions():
|
|||||||
return render_template('chartRevisionList.html', table=table)
|
return render_template('chartRevisionList.html', table=table)
|
||||||
|
|
||||||
|
|
||||||
@routes.route('/nsLookup/<tiller_ns>/<namespace>')
|
@routes.route('/nsLookup/<ns>')
|
||||||
def namespaceLookup(tiller_ns, namespace):
|
def namespaceLookup(ns):
|
||||||
charts = get_charts(tiller_ns, namespace)
|
charts = get_charts(ns)
|
||||||
return jsonify(charts)
|
return jsonify(charts)
|
||||||
|
|
||||||
@routes.route('/deployChartRevision/<revision>/<chart>/<tiller_ns>', methods=['POST'])
|
@routes.route('/deployChartRevision/<revision>/<chart>/<tiller_ns>', methods=['POST'])
|
||||||
|
|||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
ns = nsSelect.value;
|
ns = nsSelect.value;
|
||||||
|
|
||||||
fetch('/nsLookup/' + ns + '/default').then(function(response) {
|
fetch('/nsLookup/' + ns).then(function(response) {
|
||||||
response.json().then(function(data) {
|
response.json().then(function(data) {
|
||||||
if (data != 'EMPTY') {
|
if (data != 'EMPTY') {
|
||||||
var optionHTML = '';
|
var optionHTML = '';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user