include retry link after failed spawn

This commit is contained in:
Min RK
2019-04-01 12:50:33 +02:00
parent 2b18c64081
commit 6fa3b429db
2 changed files with 34 additions and 8 deletions

View File

@@ -281,13 +281,18 @@ class SpawnPendingHandler(BaseHandler):
# Implicit spawn on /user/:name is not allowed if the user's last spawn failed. # Implicit spawn on /user/:name is not allowed if the user's last spawn failed.
# We should point the user to Home if the most recent spawn failed. # We should point the user to Home if the most recent spawn failed.
exc = spawner._spawn_future.exception() exc = spawner._spawn_future.exception()
self.log.error( self.log.error("Previous spawn for %s failed: %s", spawner._log_name, exc)
"Preventing implicit spawn for %s because last spawn failed: %s", spawn_url = url_path_join(self.hub.base_url, "spawn", user.escaped_name)
spawner._log_name, self.set_status(500)
exc, html = self.render_template(
"not_running.html",
user=user,
server_name=server_name,
spawn_url=spawn_url,
failed=True,
) )
# raise a copy because each time an Exception object is re-raised, its traceback grows self.finish(html)
raise copy.copy(exc).with_traceback(exc.__traceback__) return
# Check for pending events. This should usually be the case # Check for pending events. This should usually be the case
# when we are on this page. # when we are on this page.

View File

@@ -5,12 +5,33 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="text-center"> <div class="text-center">
{% block heading %}
<h1>
{% if failed %}
Spawn failed
{% else %}
Server not running
{% endif %}
</h1>
{% endblock %}
{% block message %} {% block message %}
<p>Server {{ server_name }} is not running. Would you like to start it?</p> <p>
{% if failed %}
The latest attempt to start your server {{ server_name }} has failed.
Would you like to retry starting it?
{% else %}
Your server {{ server_name }} is not running. Would you like to start it?
{% endif %}
</p>
{% endblock %} {% endblock %}
{% block start_button %} {% block start_button %}
<a id="start" role="button" class="btn btn-lg btn-primary" href="{{ spawn_url }}"> <a id="start" role="button" class="btn btn-lg btn-primary" href="{{ spawn_url }}">
Launch Server {{ server_name }} {% if failed %}
Relaunch
{% else %}
Launch
{% endif %}
Server {{ server_name }}
</a> </a>
{% endblock %} {% endblock %}
</div> </div>