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
-
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 theOutputVariables
parameter -- these were the things I was testing. The documentation onOSCall
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 theOSCall
.If I comment out either the
OSCall
or theLog-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
...?
-
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