Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38175

Preparing Jenkins for shutdown via Manage Jenkins -> system-log-out.png throws an HTTP 405 (POST is required for jenkins.model.Jenkins.doQuietDown); works fine via "Prepare for Shutdown" link

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core

      1. Go to your /manage page
      2. Scroll down to "Prepare for Shutdown"
      3. Instead of clicking the linked text, click on the "system-log-out.png" icon to its left

      Actual Results:

      1. Jenkins throws an HTTP 405 error, with "POST is required for jenkins.model.Jenkins.doQuietDown" displayed, as well as a button labeled "Try POSTing"
      2. Upon clicking "Try POSTing," you're returned an HTTP 403 with "No valid crumb was included in the request"

          [JENKINS-38175] Preparing Jenkins for shutdown via Manage Jenkins -> system-log-out.png throws an HTTP 405 (POST is required for jenkins.model.Jenkins.doQuietDown); works fine via "Prepare for Shutdown" link

          Stephen Donner created issue -
          Daniel Beck made changes -
          Assignee New: Daniel Beck [ danielbeck ]
          Denys Digtiar made changes -
          Attachment New: jenkins_2_19_1_dropdown_menu.png [ 34408 ]

          Denys Digtiar added a comment -

          Can also be reproduced from a drop-down menu in the breadcrumbs.

          Denys Digtiar added a comment - Can also be reproduced from a drop-down menu in the breadcrumbs.

          duemir
          POST is used only if the menu element has the option post set :
          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/resources/lib/layout/breadcrumbs.js#L213

          This one comes from http(s)://<INSTANCE>/contextMenu

          But it returns

                    {
                      "displayName": "Prepare for Shutdown",
                      "icon": "/static/f70a96ee/images/48x48/system-log-out.png",
                      "post": false,
                      "requiresConfirmation": false,
                      "subMenu": null,
                      "url": "/quietDown"
                    }
          

          but it should be post=true

              @Override
              public boolean getRequiresPOST() {
                  return true;
              }
          

          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/management/ShutdownLink.java#L58

          Thus you need to understand why the management link is loosing this info in context menu

          Arnaud Héritier added a comment - duemir POST is used only if the menu element has the option post set : https://github.com/jenkinsci/jenkins/blob/master/core/src/main/resources/lib/layout/breadcrumbs.js#L213 This one comes from http(s)://<INSTANCE>/contextMenu But it returns { "displayName" : "Prepare for Shutdown" , "icon" : "/ static /f70a96ee/images/48x48/system-log-out.png" , "post" : false , "requiresConfirmation" : false , "subMenu" : null , "url" : "/quietDown" } but it should be post=true @Override public boolean getRequiresPOST() { return true ; } https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/management/ShutdownLink.java#L58 Thus you need to understand why the management link is loosing this info in context menu
          Daniel Beck made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Daniel Beck added a comment -

          The various bugs exposed in this issue are so dumb I can't even.

          PR forthcoming.

          Daniel Beck added a comment - The various bugs exposed in this issue are so dumb I can't even. PR forthcoming.
          Daniel Beck made changes -
          Remote Link New: This issue links to "PR 2692 (Web Link)" [ 15174 ]
          Daniel Beck made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/jenkins/management/ReloadLink.java
          core/src/main/resources/jenkins/model/Jenkins/manage.jelly
          http://jenkins-ci.org/commit/jenkins/c9b878f4889659b889d03e24aa8e5cb6eb763b89
          Log:
          [FIX JENKINS-38175] Fix various ManagementLink related bugs

          • In the context menu, the 'post' flag was set iff 'requiresConfirmation'
            was set, even though they're independent (e.g. Prepare for shutdown
            requires the former but not the latter)
          • /manage screen: The icon (t:summary) does not support POST or
            confirmation links, but was set to not link only if no confirmation
            was required (i.e. POST links did not POST when the icon was clicked
            • now the icon is not clickable as a workaround)
          • /manage screen: All links requiring confirmation did POST, which masked
            the fact that the 'Reload from disk' link wasn't set up to require POST
            (it was only broken in the context menu). Now, confirmation and POST are
            separate flags, and 'Reload from disk' link now requests POST.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/management/ReloadLink.java core/src/main/resources/jenkins/model/Jenkins/manage.jelly http://jenkins-ci.org/commit/jenkins/c9b878f4889659b889d03e24aa8e5cb6eb763b89 Log: [FIX JENKINS-38175] Fix various ManagementLink related bugs In the context menu, the 'post' flag was set iff 'requiresConfirmation' was set, even though they're independent (e.g. Prepare for shutdown requires the former but not the latter) /manage screen: The icon (t:summary) does not support POST or confirmation links, but was set to not link only if no confirmation was required (i.e. POST links did not POST when the icon was clicked now the icon is not clickable as a workaround) /manage screen: All links requiring confirmation did POST, which masked the fact that the 'Reload from disk' link wasn't set up to require POST (it was only broken in the context menu). Now, confirmation and POST are separate flags, and 'Reload from disk' link now requests POST.

            danielbeck Daniel Beck
            stephendonner Stephen Donner
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: