Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    "Log scope Execution has already been completed" exception after OSCall

    Scheduled Pinned Locked Moved Support
    otterotterscript
    2 Posts 2 Posters 14 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jimbobmcgee
      last edited by jimbobmcgee

      I've been trying to understand how OSCall is supposed to work, so I can reuse some common OtterScript snippets across jobs.

      However, after successfully calling a script with an input variable, I am trying to log its output variable, and am receiving the exception "An unhandled error occurred during execution phase: Log scope Execution has already been completed.. See the error logs for more details."

      I can find no more details.

      Using a minimal example, the common/inner/child script I am trying to OSCall is:

      set $Result = Hello $Username;
      Log-Information in child script: $Result;
      

      The calling/outer/parent script is:

      set $Result = "<not set>";
      
      OSCall(
          Name:               Spikes/Hello.otter,
          Variables:          %(Username: fred),
          OutputVariables:    @(Result)
      );
      
      Log-Information in parent script: $Result;
      

      (I don't know if it is required to initialize $Result in the outer scope or whether it would be set automatically in the parent; nor whether this was even the correct usage of the OutputVariables parameter -- these were the things I was testing. The documentation on OSCall is extremely light on detail.)

      The resulting execution log is:

      DEBUG: Job will be run against servers sequentially (not asynchronously).
      DEBUG: No servers, server roles, or environments specified, and thus no servers will be targeted.
      DEBUG: Beginning execution run...
      DEBUG: Beginning execution run...
      INFO:  in child script: Hello fred
      INFO:  Execution run succeeded.
      ERROR: An unhandled error occurred during execution phase: Log scope Execution has already been completed.. See the error logs for more details.
      

      I can see from the log that it at least enters the child script and accepts the input variable (as evidenced by the in child script message), but it does not complete the subsequent log statement in the parent scope after the OSCall.

      If I comment out either the OSCall or the Log-Information in the parent script, the error does not occur.

      If I try the slightly more complicated parent script...

      for server localhost {
          set $Result = "<not set>";
      
          Log-Information before oscall: $Result;
      
          Create-File
          (
              Name: "C:\ProgramData\InedoOutput.1.txt",
              Text: "in parent script: $Result",
              Overwrite: true
          );
      
          OSCall(
              Name:               Spikes/Hello.otter,
              Variables:          %(Username: fred),
              OutputVariables:    @(Result)
          );
      
          Create-File
          (
              Name: "C:\ProgramData\InedoOutput.2.txt",
              Text: "in parent script: $Result",
              Overwrite: true
          );
      
          Log-Information in parent script: $Result;
      }
      

      ...I don't get the Log Scope Execution... message, but I do get Execution run failed, and only the first file (InedoOutput.1.txt) is created:

      DEBUG: Job will be run against servers sequentially (not asynchronously).
      DEBUG: No servers, server roles, or environments specified, and thus no servers will be targeted.
      DEBUG: Beginning execution run...
      INFO:  before oscall: <not set>
      INFO:  Creating file...
      DEBUG: Creating directories for C:\ProgramData\InedoOutput.1.txt...
      DEBUG: Creating C:\ProgramData\InedoOutput.1.txt...
      INFO:  C:\ProgramData\InedoOutput.1.txt file created.
      DEBUG: Beginning execution run...
      INFO:  in child script: Hello fred
      DEBUG: Execution run succeeded.
      DEBUG: Cleaning up temporary files on Local Server...
      ERROR: Execution run failed.
      DEBUG: Cleaning up temporary files on Local Server...
      

      It seems nothing will run after an OSCall...?

      dean-houstonD 1 Reply Last reply Reply Quote 0
      • dean-houstonD Offline
        dean-houston inedo-engineer @jimbobmcgee
        last edited by

        Hi @jimbobmcgee ,

        Thanks for all the details; we plan to review/investigate this via OT-518 in an upcoming maintenance release, likely in the next few two-week cycles.

        -- Dean

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post
        Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation