Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-4800

WS GshTemplateExec returns success even though GshTemplateExecOutput.isSuccess=false

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 4.5.0, 5.3.0
    • None
    • GSH Templates, WS
    • None

    Description

      If a gsh template calls GshTemplateOutput.assignIsError(true), this works in the UI to signal a failure. But when called from WS, the result does not look at this value. It only returns a non-success if (a) input validation fails, or (b) there is an exception attached to the output.

      The workaround of having gsh throw an exception is undesirable for a few reasons. One is that it dumps the very large stacktrace plus the entire script in the UI, which isn't desirable for non-admins to see. The other is that WS only returns the exception stacktrace (plus the entire script), but not any output lines that had been set before the exception occurred.

      Template:

      ...gsh_builtin_gshTemplateOutput.assignIsError(true)...
      

      WS result:

      POST http://localhost:8080/grouper/servicesRest/v4_1_6/gshTemplateExec
       
      HTTP/1.1 200 
      Set-Cookie: JSESSIONID=45EF9223F3597E50C756DCBE659B5DD6; Path=/grouper; HttpOnly
      X-Grouper-resultCode: SUCCESS
      X-Grouper-success: T
      X-Grouper-resultCode2: NONE
      Content-Type: application/json;charset=UTF-8
      Content-Length: 582
      Date: Sun, 25 Jun 2023 00:53:51 GMT
      Keep-Alive: timeout=20
      Connection: keep-alive
       
      {
        "WsGshTemplateExecResult": {
          "resultMetadata": {
            "success": "T",
            "resultCode": "SUCCESS",
            "resultMessage": "Success for: clientVersion: 4.1.6, configId: errorTemplate, ownerType: stem , inputs: Empty array\n, actAsSubject: null, paramNames: \n, params: null"
          },
          "gshOutputLines": [
            {
              "messageType": "success",
              "text": "START"
            },
            {
              "messageType": "error",
              "text": "**Failed to fully create project: *errorMessage*"
            },
            {
              "messageType": "success",
              "text": "**Failed to fully create project: *errorMessage*"
            }
          ],
          "responseMetadata": {
            "serverVersion": "4.1.6",
            "millis": "151"
          },
          "gshValidationLines": [],
          "transaction": true
        }
      }
      

      Attachments

        Activity

          People

            chad.redman.3@at.internet2.edu Chad Redman
            chad.redman.3@at.internet2.edu Chad Redman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: