mirror of
git://git.savannah.gnu.org/guix/guix-cuirass.git
synced 2024-12-29 11:40:16 +01:00
http: Change /build/ID/restart from ‘GET’ to ‘POST’.
Not all crawlers honor ‘robots.txt’ and some could end up restarting random failed builds (not surprisingly, perhaps!). * src/cuirass/http.scm (url-handler): Change /build/ID/restart to POST. * src/cuirass/templates.scm (build-details): Change “Restart” drop-down menu item to a POST form with a button. * tests/http.scm ("/build/1/restart redirects to /admin") ("/build/3/restart is unprivileged (failed build)"): Adjust accordingly.
This commit is contained in:
parent
e611adcca7
commit
eb4771308e
3 changed files with 9 additions and 6 deletions
|
@ -1005,7 +1005,7 @@ return DEFAULT."
|
|||
. ,(string-append "/build/" (number->string id)
|
||||
"/details"))))))
|
||||
(respond-not-found (uri->string (request-uri request))))))
|
||||
(('GET "build" (= string->number (? integer? id)) "restart")
|
||||
(('POST "build" (= string->number (? integer? id)) "restart")
|
||||
(match (db-get-build id)
|
||||
(#f
|
||||
(respond-not-found (uri->string (request-uri request))))
|
||||
|
|
|
@ -771,9 +771,12 @@ the existing SPEC otherwise."
|
|||
"Action")
|
||||
(ul (@ (class "dropdown-menu")
|
||||
(role "menu"))
|
||||
(li (@ (role "menuitem"))
|
||||
(a (@ (class "dropdown-item")
|
||||
(href "/build/" ,(build-id build) "/restart"))
|
||||
(form (@ (role "menuitem")
|
||||
(action "/build/" ,(build-id build) "/restart")
|
||||
(method "POST"))
|
||||
(button
|
||||
(@ (type "submit")
|
||||
(class "dropdown-item"))
|
||||
" Restart")))))
|
||||
(table
|
||||
(@ (class "table table-sm table-hover"))
|
||||
|
|
|
@ -289,7 +289,7 @@
|
|||
|
||||
;; This is a successful build so /build/1/restart redirects to /admin
|
||||
;; without doing anything.
|
||||
(let ((response (http-get (test-cuirass-uri "/build/1/restart"))))
|
||||
(let ((response (http-post (test-cuirass-uri "/build/1/restart"))))
|
||||
(list (response-code response)
|
||||
(uri-path (response-location response))
|
||||
(build-current-status (db-get-build 1)))))
|
||||
|
@ -299,7 +299,7 @@
|
|||
|
||||
;; This is a short and failed build so /build/3/restart actually
|
||||
;; reschedules it.
|
||||
(let ((response (http-get (test-cuirass-uri "/build/3/restart"))))
|
||||
(let ((response (http-post (test-cuirass-uri "/build/3/restart"))))
|
||||
(list (response-code response)
|
||||
(uri-path (response-location response))
|
||||
(build-current-status (db-get-build 3)))))
|
||||
|
|
Loading…
Reference in a new issue