Reorder path components
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Lauri Võsandi 2022-08-13 21:25:09 +03:00
parent 54dba98af2
commit 61f8f0f95f

View File

@ -33,7 +33,7 @@ def generate_targets():
i.metadata.name, i.metadata.name,
"innodbclusters") "innodbclusters")
for target in targets["items"]: for target in targets["items"]:
yield i.metadata.name, "innodbclusters", "-", target["metadata"]["name"] yield "innodbclusters", i.metadata.name, "-", target["metadata"]["name"]
# Handle MongoDB community operator # Handle MongoDB community operator
targets = api_instance.list_namespaced_custom_object( targets = api_instance.list_namespaced_custom_object(
@ -44,8 +44,9 @@ def generate_targets():
for target in targets["items"]: for target in targets["items"]:
for user in target["spec"]["users"]: for user in target["spec"]["users"]:
for role in user["roles"]: for role in user["roles"]:
yield i.metadata.name, "mongodbcommunity", \ yield "mongodbcommunity", i.metadata.name, \
user["name"], role["db"] user["name"], role["db"]
break
@app.route("/cronjob.sh") @app.route("/cronjob.sh")
@ -61,8 +62,8 @@ def generate_script():
return app.response_class(generate(), mimetype="text/plain") return app.response_class(generate(), mimetype="text/plain")
@app.route("/stream/<namespace>/innodbclusters/<user>/<database>") @app.route("/stream/innodbclusters/<namespace>/<user>/<database>")
def innodbclusters_stream(namespace, user, database): def stream_innodbclusters(namespace, user, database):
if request.headers.get("Authorization") != TOKEN: if request.headers.get("Authorization") != TOKEN:
raise raise
with ApiClient() as api: with ApiClient() as api:
@ -83,8 +84,8 @@ def innodbclusters_stream(namespace, user, database):
download_name="%s_%s.sql.gz" % (namespace, database)) download_name="%s_%s.sql.gz" % (namespace, database))
@app.route("/stream/<namespace>/mongodbcommunity/<user>/<database>") @app.route("/stream/mongodbcommunity/<namespace>/<user>/<database>")
def mongodbcommunity_stream(namespace, user, database): def stream_mongodbcommunity(namespace, user, database):
if request.headers.get("Authorization") != TOKEN: if request.headers.get("Authorization") != TOKEN:
raise raise
with ApiClient() as api: with ApiClient() as api:
@ -98,7 +99,7 @@ def mongodbcommunity_stream(namespace, user, database):
return send_file(process.stdout, return send_file(process.stdout,
mimetype="application/tar+gzip", mimetype="application/tar+gzip",
as_attachment=True, as_attachment=True,
download_name="%s_%s.tar.gz" % (namespace, database)) download_name="%s_%s.gz" % (namespace, database))
app.run(host="0.0.0.0", debug=False, threaded=True) app.run(host="0.0.0.0", debug=False, threaded=True)