Uploaded image for project: 'OpenAM'
  1. OpenAM
  2. OPENAM-11431

Amster should exit after running from a script with a status code indicating success/failure without having to specify :q at the end of the amster script

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 14.0.0, 14.5.1, 6.0.0, 6.0.0.1, 6.0.0.2, 7.0.0
    • Fix Version/s: None
    • Component/s: Amster
    • Labels:
      None
    • Support Ticket IDs:

      Description

      Description
      Using Amster by loading an Amster Script (.amster file) when triggered from the command line (e.g. amster install.amster) upon finishing the script remains within the amster CLI.

      This means that scripts which use amster part-way through will not continue to execute instructions after amster, unless the amster script itself explicitly exits at the end of it (e.g. by having :q as the final line of each script).

      Suggested that we change amster such that when activated from the command-line with a script as a parameter, after execution it exits with a status code indicating successful execution (0) of the script of unsuccessful (1) so that scripts can use this amster functionality appropriately.

      This would avoid having to include :q at the end of each amster script file, and allow scripts that use Amster to branch depending on this status code (e.g. using && to continue running further commands on the CLI)

      Steps to Reproduce
      Create a script, e.g. install.amster :

      install-openam --serverUrl http://openam.example.com:8080/openam --adminPwd cangetinam --acceptLicense

      Run with amster /path/to/install.amster

      Current Output: (leaves the Amster prompt open)

      07/23/2017 05:05:15:893 PM BST: Setting up monitoring authentication file.
      Configuration complete!
      am>

      Improved Output:

      07/23/2017 05:05:15:893 PM BST: Setting up monitoring authentication file.
      Configuration complete!
      Exiting with status code 0 // may not want to actually print this line 

      In the case of an incorrectly-written amster file, or the operation fails, e.g:

      Create bad_install.amster: (note the typo in acceptLicense)

       install-openam --serverUrl http://openam.example.com:8080/openam --adminPwd cangetinam --acceptLisenses

      Run with amster /path/to/bad_install.amster

      Current Output:

      You must accept the license to install OpenAM.
      This is done by adding --acceptLicense parameter.
      See http://openam.lunaforge.com:8080/openam/legal-notices/Forgerock_License.txt
      am>

      Improved Output:

      You must accept the license to install OpenAM.
      This is done by adding --acceptLicense parameter.
      See http://openam.lunaforge.com:8080/openam/legal-notices/Forgerock_License.txt
      Exiting with status code 1 // may not actually want to print this 

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              david.luna@forgerock.com David Luna
            • Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated: