Uploaded image for project: 'OpenIDM'
  1. OpenIDM
  2. OPENIDM-12778

Schedules to execute a file-based script are generated incorrectly via the Admin UI

    Details

    • Target Version/s:
    • Verified Version/s:
    • Story Points:
      2
    • Sprint:
      IAM - UI 2019.14
    • Support Ticket IDs:

      Description

      When creating a schedule within the Admin UI which will invoke a file-based script, the following payload is sent:

      {
          "_id": "schedule/helloWorld",
          "isCron": true,
          "enabled": true,
          "persisted": true,
          "type": "cron",
          "misfirePolicy": "fireAndProceed",
          "invokeService": "script",
          "invokeLogLevel": "info",
          "timeZone": null,
          "startTime": null,
          "endTime": null,
          "concurrentExecution": false,
          "invokeContext": {
              "type": "groovy",
              "globals": {},
              "file": "script/helloWorld.groovy"
          },
          "schedule": "*/10 * * * * ?"
      }
      

      However this invokeContext will not invoke the file as it should instead use the following structure:

        "invokeContext" : {
          "script": {
            "type": "groovy",
            "name": "script/helloWorld.groovy"
          }
      

      Without this change, the following error is returned:

      [137] Mar 07, 2019 10:42:40.022 AM org.forgerock.openidm.quartz.SchedulerServiceJob execute
      WARNING: Scheduled service "scheduler-service-group.helloWorld" invocation reported failure: No valid script 'scheduler-helloWorld' configured in schedule.
      org.forgerock.openidm.quartz.ExecutionException: No valid script 'scheduler-helloWorld' configured in schedule.
      	at org.forgerock.openidm.script.impl.ScriptRegistryService.execute(ScriptRegistryService.java:703)
      	at org.forgerock.openidm.quartz.SchedulerServiceJob.execute(SchedulerServiceJob.java:123)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      

      And with the change the script executes as expected:

         static void main(String[] args) {
            println "Hello World"
         }
      
      -> Hello World
      -> Hello World
      Hello World
      Hello World
      Hello World
      Hello World
      Hello World
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                huck.elliott huck.elliott
                Reporter:
                tom.wood Tom Wood
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: