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):
|
||||
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")
|
||||
|
||||
@ -25,9 +25,9 @@ def chartVersions():
|
||||
return render_template('chartRevisionList.html', table=table)
|
||||
|
||||
|
||||
@routes.route('/nsLookup/<tiller_ns>/<namespace>')
|
||||
def namespaceLookup(tiller_ns, namespace):
|
||||
charts = get_charts(tiller_ns, namespace)
|
||||
@routes.route('/nsLookup/<ns>')
|
||||
def namespaceLookup(ns):
|
||||
charts = get_charts(ns)
|
||||
return jsonify(charts)
|
||||
|
||||
@routes.route('/deployChartRevision/<revision>/<chart>/<tiller_ns>', methods=['POST'])
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user