diff --git a/PAS/Management/OEManager/ABL/USAGE.md b/PAS/Management/OEManager/ABL/USAGE.md index 4fbe0d1..3b67be6 100644 --- a/PAS/Management/OEManager/ABL/USAGE.md +++ b/PAS/Management/OEManager/ABL/USAGE.md @@ -29,12 +29,12 @@ The following represents the default usage for all tasks which can be executed u [echo] Status/Info: [echo] [echo] oemanager status - [RO] Obtain MSAgent/connection status information for an ABL App - [echo] [OPTIONAL] -Dbasemem=819200 - Minimum memory threshold, in bytes, of unused agent sessions + [echo] [OPTIONAL] -Dbasemem=819200 - Minimum memory threshold (bytes) to consider as 'unused' agent sessions [echo] [echo] oemanager stacks - [RO] Obtain stack information for all MSAgents for an ABL App [echo] [OPTIONAL] -Dpid=[AGENT_PID] - Limit stack information to a specific MSAgent process ID [echo] [OPTIONAL] -Dsessid=[SESSION_ID] - Limit stack information to a specific ABL Session ID - [echo] Requires specifying an MSAgent via pid=[AGENT_PID] + [echo] Requires specifying an MSAgent via -Dpid=[AGENT_PID] [echo] [echo] oemanager flush - [RO] Flush the available deferred log buffer to agent log file [echo] @@ -52,13 +52,9 @@ The following represents the default usage for all tasks which can be executed u [echo] [echo] oemanager close - Perform a 'soft restart' of an ABL App (runs: status, flush + trimhttp + stop, status) [echo] For this task the 'trimhttp' will be called with the termination option 1 (forced) - [echo] [REQUIRED] -Dwebapp=[WEBAPP_NAME] - WebApp for Tomcat Manager to terminate active sessions + [echo] [REQUIRED] -Dwebapp=[WEBAPP_NAME] - WebApp for Tomcat Manager to terminate active client sessions [echo] The given WebApp is expected to be associated with the provided -Dablapp name - [echo] [OPTIONAL] -Dsleep=1 - Sleep time in minutes after stop - [echo] - [echo] oemanager refresh - Refresh ABL Sessions for each MSAgent for an ABL App (OE 12 Only) - [echo] Note: This will essentially terminate all sessions (gracefully), - [echo] and prepare the Agent to pick up any R-code changes + [echo] [OPTIONAL] -Dsleep=1 - Sleep time in minutes after stop, prior to final 'status' output [echo] [echo] oemanager reset - Reset an aspect of each MSAgent for an ABL App [echo] [REQUIRED] -Dresettype=stats [stats|logs] @@ -80,7 +76,7 @@ The following represents the default usage for all tasks which can be executed u [echo] [echo] oemanager trimall - Trim all available ABL Sessions (via the Agent Manager) for each MSAgent for an ABL App [echo] Note: For any busy sessions considered stuck use 'trimhttp' with a specific Session ID - [echo] [OPTIONAL] -Dterminateopt=0 - Termination Option: 0=graceful, 1=forced, 2=finish/stop + [echo] [OPTIONAL] -Dterminateopt=0 - Termination Option: 0=graceful, 1=forced, 2=finish+stop [echo] [echo] oemanager trimidle - Trim only the IDLE ABL Sessions (via the Agent Manager) for each MSAgent for an ABL App [echo] Allows for manually scaling down an MSAgent which may have many unused ABL Sessions @@ -93,6 +89,11 @@ The following represents the default usage for all tasks which can be executed u [echo] [OPTIONAL] -Dsessid=[SESSION_ID] - Alphanumeric Client Session ID to be stopped [echo] When no session ID provided, all available Client HTTP Sessions will be expired [echo] [OPTIONAL] -Dterminateopt=0 - Termination Option: 0=graceful, 1=forced, 2=finish+stop + [echo] + [echo] oemanager refresh - Refresh ABL Sessions for each MSAgent for an ABL App + [echo] Note: This will terminate all sessions using the 'finish+stop' option, + [echo] which prepares the MSAgent to pick up available R-code changes. + [echo] Use this only during a 'quiet period' for your application. ## Tailoring ## @@ -131,7 +132,7 @@ The following have a distinct effect on the operation of a PAS instance and shou - **add** - [Starts a new MSAgent](https://docs.progress.com/bundle/pas-for-openedge-reference/page/Add-a-multi-session-agent.html) for an ABL Application, provided the maxAgents setting has not yet been reached. - **stop** - [Stops a running MSAgent](https://docs.progress.com/bundle/pas-for-openedge-reference/page/Stop-a-multi-session-agent.html) for an ABL Application, provided there are any MSAgents to be stopped. It is advised to use the "close" task to adequately prepare each ABL Application for termination which includes terminating any active connections and stopping all running MSAgents. -- **close** - This is a synthetic task which executes many of the existing tasks in a specific order to help safely prepare a PAS instance for shutdown. Before and after all of the following tasks are run, the "status" task is run to get a snapshot of the ABL Application. Any deferred log information is then flushed (flush), any available Client HTTP Sessions are terminated gracefully (trimhttp), and all MSAgents for the ABL Application are stopped (stop). +- **close** - This is a compound task which executes several existing tasks in a specific order to help safely prepare a PAS instance for shutdown. Before and after all of the following tasks are run, the "status" task is run to get a snapshot of the ABL Application. Any deferred log information is then flushed (flush), any available Client HTTP Sessions are terminated gracefully (trimhttp), and all MSAgents for the ABL Application are stopped (stop). - **reset** - Used to either reset internal MSAgent stats or to [clear any accumulated deferred log data](https://docs.progress.com/bundle/pas-for-openedge-reference/page/Reset-deferred-log-buffer.html). In most cases these actions will not be needed unless instructed by tech support. - **trimhttp / trimsingle / trimall / trimidle / refresh** - These tasks all affect the termination of "sessions" which requires additional context for correct operation. Please see the next section on **Trimming Sessions** for those details. @@ -148,6 +149,6 @@ We use the term "trim" as a carry-over from Classic AppServer and WebSpeed where - This task will only work against available HTTP connections. If no active sessions are present, no impact to existing ABL Sessions will be observed--in this situation one of the 3 "trim" tasks in the next section can/should be used. - **trimsingle** / **trimall** / **trimidle** - When there are no active or bound/reserved Client HTTP Sessions the use of these may be run to reduce the number of running ABL Sessions for an MSAgent. This can be an effective means of scaling down an MSAgent which has started a large number of ABL Sessions which are no longer of use. All 3 of these tasks operate in a similar manner, first obtaining a list of current ABL Sessions for an MSAgent and iterating over those sessions using any applicable criteria. For the "trimsingle" this will only terminate an ABL Session which matches the given session ID, while "trimidle" will only terminate an ABL Session if its status is reported as "IDLE". Before each session is terminated, the current session stack information will be written to disk to identify what may have been running at the time the termination was requested. These actions utilize the API endpoint to [terminate a single ABL Session](https://docs.progress.com/bundle/pas-for-openedge-reference/page/Terminate-an-ABL-session.html) (note: link goes to the OEJMX query as we do not have a page which covers this action via the OEM REST API's). - It is advised to use the "**trimhttp**" task first to terminate any active or lingering Client HTTP Sessions first, then use the appropriate task above to terminate additional ABL Sessions. -- **refresh** - This task is a built-in operation which behaves similar to the "trimall" task with one crucial difference: Whereas the "trim" tasks (just covered above) will iterate directly over each ABL Session of an MSAgent, this acts upon the MSAgent itself. In other words, refresh tells the MSAgent of an ABL Application to terminate all of its current ABL Sessions, thereby refreshing the MSAgent so that changes to the application can be picked up. The refresh API allows newly-created sessions to use the updated persistent procedures, static objects, or online schema changes, and starts running sessions against the new application code. This task was intended to be used for high-availability environments, during a "quiet period" with no user activity, where new code may be deployed but it is not desirable to shut down or restart the entire PAS instance, only to refresh the running MSAgents. More information on this operation may be found [here in the product documentation](https://docs.progress.com/bundle/pas-for-openedge-management/page/Refresh-agents-in-an-ABL-application.html). +- **refresh** - This task is a built-in operation which behaves similar to the "trimall" task with the Finish+Stop termination option. Whereas the "trim" tasks (just covered above) will iterate directly over each ABL Session of an MSAgent, this acts upon the MSAgent itself. In other words, refresh tells the MSAgent of an ABL Application to terminate all of its current ABL Sessions, thereby refreshing the MSAgent so that changes to the application can be picked up. The refresh API allows newly-created sessions to use the updated persistent procedures, static objects, or online schema changes, and starts running sessions against the new application code. This task was intended to be used for high-availability environments, during a "quiet period" with no user activity, where new code may be deployed but it is not desirable to shut down or restart the entire PAS instance, only to refresh the running MSAgents. More information on this operation may be found [here in the product documentation](https://docs.progress.com/bundle/pas-for-openedge-management/page/Refresh-agents-in-an-ABL-application.html). - **Warning:** This task is not intended to be used when a PAS instance is serving active requests, or if it may have stuck/busy sessions. You should make use of the "trim" tasks above to gracefully terminate those sessions prior to using the refresh task. - As an alternative to the suggested "trim" tasks, the "**close**" task will gracefully terminate any existing Client HTTP Sessions then stop all MSAgents for an ABL Application. This allows the MSAgent to return any memory back to the OS, and then use the "**add**" task to start one or more new MSAgents. diff --git a/PAS/Management/OEManager/ABL/conf/oemanager.xml b/PAS/Management/OEManager/ABL/conf/oemanager.xml index 84218d2..89399f7 100644 --- a/PAS/Management/OEManager/ABL/conf/oemanager.xml +++ b/PAS/Management/OEManager/ABL/conf/oemanager.xml @@ -59,18 +59,6 @@ - - - - - - - - - - - - @@ -86,7 +74,7 @@ - + @@ -97,6 +85,19 @@ + + + + + + + + + + + + + diff --git a/PAS/Management/OEManager/ABL/release.txt b/PAS/Management/OEManager/ABL/release.txt index 829f099..e751d3b 100644 --- a/PAS/Management/OEManager/ABL/release.txt +++ b/PAS/Management/OEManager/ABL/release.txt @@ -1 +1 @@ -2024-03-07T10:53:42.096 \ No newline at end of file +2024-03-12T14:42:02.106 \ No newline at end of file diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/addAgent.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/addAgent.p index f9a4a17..4fe89b1 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/addAgent.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/addAgent.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -68,6 +68,9 @@ oMgrConn:LogCommand("RUN", this-procedure:name). message substitute("Starting new MSAgent for &1...", cAblApp). message oMgrConn:AddAgent(cAblApp). +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/flushLogs.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/flushLogs.p index 47023b3..b07c88e 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/flushLogs.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/flushLogs.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -74,7 +74,8 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Initial URL to obtain a list of all MSAgents for an ABL Application. */ message substitute("Flushing deferred log buffer for MSAgents of &1...", cAblApp). -oAgents = oMgrConn:GetAgents(cAblApp). +assign oAgents = oMgrConn:GetAgents(cAblApp). + if oAgents:Length eq 0 then message "No MSAgents running". else @@ -96,7 +97,11 @@ on stop undo, next AGENTBLK: message substitute("Agent PID &1 not AVAILABLE, skipping flush.", oAgent:GetCharacter("pid")). end. /* iLoop - agent */ +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ + {&_proparse_ prolint-nowarn(returnfinally)} return string(0). end finally. diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLockStats.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLockStats.p index 829e06d..404cc88 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLockStats.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLockStats.p @@ -88,9 +88,9 @@ repeat: // As of OE 12.5 a new field _Connect-Details was added to hold a unique string to identify connections from a PAS instance. // https://docs.progress.com/bundle/openedge-whats-new/page/Whats-New-in-OpenEdge-12.5.html#ariaid-title15 - assign hConnDetFld = hConnBuffer:buffer-field("_Connect-Details") no-error. // Purposeful no-error here. - if error-status:error then - error-status:error = false. // Ignore any generated error from above. + assign hConnDetFld = hConnBuffer:buffer-field("_Connect-Details") no-error. // Purposeful no-error here. + if error-status:error then + error-status:error = false. // Ignore any generated error from above. if valid-object(hConnDetFld) then do: // The format of the data in this field should be "Container:Host:AgentPID:SessID" assign cConnDetail = hConnDetFld:buffer-value(). diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLocks.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLocks.p index b5185dc..54e02b6 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLocks.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getLocks.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -266,6 +266,10 @@ procedure getAblApplications: if oApp:Has("name") and oApp:Has("type") and oApp:GetCharacter("type") eq "OPENEDGE" then oAblApps:Add(new OpenEdge.Core.String(oApp:GetCharacter("name"))). end. /* iLoop - Application */ + + catch err as Progress.Lang.Error: + put unformatted substitute("~nUnable to get application list from PASOE instance: &1", err:GetMessage(1)) skip. + end catch. end procedure. procedure getAblAppAgents: diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStacks.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStacks.p index 81a24c2..57b3f71 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStacks.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStacks.p @@ -143,6 +143,9 @@ else do: end. /* iLoop - agent */ end. // All Agents +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStatus.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStatus.p index b2e51b4..c4dc8a6 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStatus.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/getStatus.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -279,6 +279,10 @@ procedure GetApplications: assign lIsMin122 = (oVersion:Major eq 12 and oVersion:Minor ge 2) or oVersion:Major gt 12. assign lIsMin127 = (oVersion:Major eq 12 and oVersion:Minor ge 7) or oVersion:Major gt 12. assign lIsMin128 = (oVersion:Major eq 12 and oVersion:Minor ge 8) or oVersion:Major gt 12. + + catch err as Progress.Lang.Error: + put unformatted substitute("~nUnable to get application list from PASOE instance: &1", err:GetMessage(1)) skip. + end catch. end procedure. /* Get the configured max for ABLSessions/Connections per MSAgent, along with min/max/initial MSAgents. */ diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/refreshAgents.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/refreshAgents.p index 06e8754..e33787b 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/refreshAgents.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/refreshAgents.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -79,6 +79,7 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Initial URL to obtain a list of all MSAgents for an ABL Application. */ message substitute("Looking for MSAgents of &1...", cAblApp). assign oAgents = oMgrConn:GetAgents(cAblApp). + if oAgents:Length eq 0 then message "No MSAgents running". else @@ -114,6 +115,9 @@ on stop undo, next AGENTBLK: message substitute("MSAgent PID &1 not AVAILABLE, skipping refresh.", cPID). end. /* iLoop - agent */ +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/reset.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/reset.p index c763571..4418229 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/reset.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/reset.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -86,6 +86,7 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Initial URL to obtain a list of all MSAgents for an ABL Application. */ message substitute("Looking for MSAgents of &1...", cAblApp). assign oAgents = oMgrConn:GetAgents(cAblApp). + if oAgents:Length eq 0 then message "No MSAgents running". else @@ -124,6 +125,9 @@ on stop undo, next AGENTBLK: end. /* do stop-after */ end. /* iLoop - agent */ +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/stopAgents.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/stopAgents.p index d2ab6c0..64bccda 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/stopAgents.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/stopAgents.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -93,6 +93,7 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Initial URL to obtain a list of all MSAgents for an ABL Application. */ message substitute("Looking for MSAgents of &1...", cAblApp). assign oAgents = oMgrConn:GetAgents(cAblApp). + if oAgents:Length eq 0 then message "No MSAgents running". else @@ -142,6 +143,9 @@ on stop undo, next AGENTBLK: end. /* do stop-after */ end. /* iLoop - agent */ +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSession.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSession.p index fa60837..3bf0994 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSession.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSession.p @@ -1,5 +1,5 @@ /* - Copyright 2022-2023 Progress Software Corporation + Copyright 2022-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -114,6 +114,7 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Initial URL to obtain a list of all AgentSessions for an MSAgent of an ABL Application. */ message substitute("Looking for MSAgent &1 of &2...", cPID, cAblApp). assign oSessions = oMgrConn:GetAgentSessions(cAblApp, integer(cPID)). + assign iTotSess = oSessions:Length. if iTotSess gt 0 then SESSIONBLK: @@ -163,6 +164,9 @@ end. /* iLoop - session */ if not lFound then /* Report on whether the session was even found. */ message substitute("ABL Session &1 not available.", cSessID). +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessions.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessions.p index a30d14a..96deaab 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessions.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessions.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -105,6 +105,7 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Initial URL to obtain a list of all MSAgents for an ABL Application. */ message substitute("Looking for MSAgents of &1...", cAblApp). assign oAgents = oMgrConn:GetAgents(cAblApp). + if oAgents:Length eq 0 then message "No MSAgents running". else @@ -177,6 +178,9 @@ on stop undo, next AGENTBLK: message substitute("MSAgent PID &1 not AVAILABLE, skipping trim.", cPID). end. /* iLoop - agent */ +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessionsTest.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessionsTest.p index eecd31f..9ec4da5 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessionsTest.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimABLSessionsTest.p @@ -1,5 +1,5 @@ /* - Copyright 2022-2023 Progress Software Corporation + Copyright 2022-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -106,6 +106,7 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Initial URL to obtain a list of all MSAgents for an ABL Application. */ message substitute("Looking for MSAgents of &1...", cAblApp). assign oAgents = oMgrConn:GetAgents(cAblApp). + if oAgents:Length eq 0 then message "No MSAgents running". else @@ -190,6 +191,9 @@ on stop undo, next AGENTBLK: message substitute("MSAgent PID &1 not AVAILABLE, skipping trim.", cPID). end. /* iLoop - agent */ +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimSessMgrSessions.p b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimSessMgrSessions.p index 61e7c9f..9af786a 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimSessMgrSessions.p +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Cli/trimSessMgrSessions.p @@ -1,5 +1,5 @@ /* - Copyright 2020-2023 Progress Software Corporation + Copyright 2020-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -116,6 +116,7 @@ oMgrConn:LogCommand("RUN", this-procedure:name). /* Create an easy lookup of alphanumeric AgentID's to a matching PID. */ assign oAgentMap = new StringStringMap(). assign oAgents = oMgrConn:GetAgents(cAblApp). + if oAgents:Length gt 0 then do iLoop = 1 to oAgents:Length: oAgentMap:Put(oAgents:GetJsonObject(iLoop):GetCharacter("agentId"), oAgents:GetJsonObject(iLoop):GetCharacter("pid")). @@ -211,6 +212,9 @@ if (cSessID gt "") ne true then do: end. /* oJsonResp - Tomcat */ end. /* sessions */ +catch err as Progress.Lang.Error: + put unformatted substitute("~nError while communicating with PASOE instance: &1", err:GetMessage(1)) skip. +end catch. finally: /* Return value expected by PCT Ant task. */ {&_proparse_ prolint-nowarn(returnfinally)} diff --git a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Util/OEManagerConnection.cls b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Util/OEManagerConnection.cls index 4ac754c..e466438 100644 --- a/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Util/OEManagerConnection.cls +++ b/PAS/Management/OEManager/ABL/src/OpenEdge/ApplicationServer/Util/OEManagerConnection.cls @@ -1,5 +1,5 @@ /* - Copyright 2022-2023 Progress Software Corporation + Copyright 2022-2024 Progress Software Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -279,34 +279,69 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog case true: when type-of(oResp:Entity, OpenEdge.Core.Memptr) then undo, throw new Progress.Lang.AppError(substitute("Response is a memptr of size &1", - string(cast(oResp:Entity, OpenEdge.Core.Memptr):Size)), 0). + string(cast(oResp:Entity, OpenEdge.Core.Memptr):Size)), oResp:StatusCode). when type-of(oResp:Entity, OpenEdge.Core.String) then - undo, throw new Progress.Lang.AppError(string(cast(oResp:Entity, OpenEdge.Core.String):Value), 0). + undo, throw new Progress.Lang.AppError(string(cast(oResp:Entity, OpenEdge.Core.String):Value), oResp:StatusCode). when type-of(oResp:Entity, JsonObject) then {&_proparse_ prolint-nowarn(overflow)} - undo, throw new Progress.Lang.AppError(string(cast(oResp:Entity, JsonObject):GetJsonText()), 0). + undo, throw new Progress.Lang.AppError(string(cast(oResp:Entity, JsonObject):GetJsonText()), oResp:StatusCode). otherwise undo, throw new Progress.Lang.AppError(substitute("Unknown type of response object: &1 [HTTP-&2]", - oResp:Entity:GetClass():TypeName, oResp:StatusCode), 0). + oResp:Entity:GetClass():TypeName, oResp:StatusCode), oResp:StatusCode). end case. else if valid-object(oResp) then /* Response is available, but entity is not. Just report the HTTP status code. */ - undo, throw new Progress.Lang.AppError(substitute("Unsuccessful status from server: HTTP-&1", oResp:StatusCode), 0). + undo, throw new Progress.Lang.AppError(substitute("Unsuccessful status from server: HTTP-&1", oResp:StatusCode), oResp:StatusCode). else /* Response is not even available (valid) so report that as an explicit case. */ - undo, throw new Progress.Lang.AppError("Invalid response from server, ", 0). + undo, throw new Progress.Lang.AppError("Invalid or unknown response from server", 500). end. /* failure */ catch err as Progress.Lang.Error: + define variable oReturnObj as JsonObject. + assign oReturnObj = new JsonObject(). + /* Always report any errors during the API requests, and return an empty JSON object allowing remaining logic to continue. */ - this-object:Logger:Error(substitute("Error executing remote request: &1 [URL: &2]", err:GetMessage(1), cURL)). - return new JsonObject(). + case err:GetMessageNum(1): + when 401 then do: + /** + * Return of a 401 indicates the server is running and that the webapp exists, + * but either no credentials were given or were rejected as incorrect. + */ + this-object:Logger:Error(substitute("Error executing remote request: Invalid Credentials [URL: &1]", cURL)). + oReturnObj:Add("error", "Invalid Credentials"). + end. + when 403 then do: + /** + * Return of a 403 indicates the server is running but the oemanager webapp was most likely not deployed, + * as the default response for an unknown URI is to make it forbidden. + */ + this-object:Logger:Error(substitute("Error executing remote request: Management WebApp(s) Not Deployed [URL: &1]", cURL)). + oReturnObj:Add("error", "Management WebApp(s) Not Deployed"). + end. + when 500 then do: + /** + * Anything explicitly returned as a 500 error indicates a server error and no further details need be given. + */ + this-object:Logger:Error(substitute("Error executing remote request: Invalid Server Response [URL: &1]", cURL)). + oReturnObj:Add("error", "Invalid Server Response"). + end. + otherwise do: + /** + * All other errors would be out of the norm and should be reported for troubleshooting. + */ + this-object:Logger:Error(substitute("Error executing remote request: &1 [URL: &2]", err:GetMessage(1), cURL)). + oReturnObj:Add("error", err:GetMessage(1)). + end. + end case. + + return oReturnObj. end catch. finally: - delete object oReq no-error. + delete object oReq no-error. delete object oResp no-error. end finally. end method. /* MakeRequest */ @@ -371,6 +406,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(OEManagerEndpoint:Applications). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "Application", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("Application"). @@ -392,6 +431,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable cOutMsg as character no-undo. assign oJsonResp = this-object:PostData(substitute(OEManagerEndpoint:AddAgent, pcAblApp)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if valid-object(oJsonResp) and JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: oAgent = oJsonResp:GetJsonObject("result"). @@ -403,10 +446,7 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog assign cOutMsg = cOutMsg + this-object:GetOpOutcome(oJsonResp). end. /* result */ - finally: - {&_proparse_ prolint-nowarn(returnfinally)} - return cOutMsg. // Always return available content. - end finally. + return cOutMsg. // Always return available content. end method. /* AddAgent */ /* Get a listing of available MSAgents for an ABL Application @@ -418,6 +458,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:Agents, pcAblApp)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "agents", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("agents"). @@ -437,6 +481,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentSessCombined, pcAblApp)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "agents", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("agents"). @@ -456,6 +504,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentManagerProperties, pcAblApp)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then return oJsonResp:GetJsonObject("result"). else @@ -472,6 +524,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentMetrics, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "AgentStatHist", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("AgentStatHist"). @@ -493,6 +549,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentSessions, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "AgentSession", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("AgentSession"). @@ -516,6 +576,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentSessionStacks, pcAblApp, piPID, piSession)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "ABLStacks", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("ABLStacks"). @@ -539,6 +603,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentSessionStacks, pcAblApp, piPID, pcSession)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "ABLStacks", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("ABLStacks"). @@ -559,6 +627,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentStacks, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "ABLStacks", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("ABLStacks"). @@ -580,6 +652,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:AgentThreads, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "AgentThread", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("AgentThread"). @@ -600,6 +676,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:ClientSessions, pcAblApp)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "OEABLSession", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("OEABLSession"). @@ -621,6 +701,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:DynamicSessionLimit, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then do: if JsonPropertyHelper:HasTypedProperty(oJsonResp:GetJsonObject("result"), "AgentSessionInfo", JsonDataType:Array) then return oJsonResp:GetJsonObject("result"):GetJsonArray("AgentSessionInfo"). @@ -640,6 +724,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:SessionManagerProperties, pcAblApp)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then return oJsonResp:GetJsonObject("result"). else @@ -655,6 +743,10 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog define variable oJsonResp as JsonObject no-undo. assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:SessionMetrics, pcAblApp)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "result", JsonDataType:Object) then return oJsonResp:GetJsonObject("result"). else @@ -669,7 +761,14 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog @return JsonObject Object as server response */ method public JsonObject FlushDeferredLog ( input pcAblApp as character, input piPID as integer ): - return this-object:GetData(substitute(OEManagerEndpoint:FlushDeferredLog, pcAblApp, piPID)). + define variable oJsonResp as JsonObject no-undo. + + assign oJsonResp = this-object:GetData(substitute(OEManagerEndpoint:FlushDeferredLog, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + else + return oJsonResp. end method. /* FlushDeferredLog */ /* Trigger a refresh (termination) of all sessions of an MSAgent for an ABL Application @@ -680,7 +779,14 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog @return JsonObject Object as server response */ method public JsonObject RefreshAgent ( input pcAblApp as character, input pcAgentID as character ): - return this-object:DeleteData(substitute(OEManagerEndpoint:AgentSessions, pcAblApp, pcAgentID)). + define variable oJsonResp as JsonObject no-undo. + + assign oJsonResp = this-object:DeleteData(substitute(OEManagerEndpoint:AgentSessions, pcAblApp, pcAgentID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + else + return oJsonResp. end method. /* RefreshAgent */ /* Clear (reset) any accumulated agent stat data of an MSAgent for an ABL Application @@ -690,7 +796,14 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog @return JsonObject Object as server response */ method public JsonObject ResetAgentStats ( input pcAblApp as character, input piPID as integer ): - return this-object:DeleteData(substitute(OEManagerEndpoint:AgentStatData, pcAblApp, piPID)). + define variable oJsonResp as JsonObject no-undo. + + assign oJsonResp = this-object:DeleteData(substitute(OEManagerEndpoint:AgentStatData, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + else + return oJsonResp. end method. /* ResetAgentStats */ /* Clear (reset) any accumulated deferred log data of an MSAgent for an ABL Application @@ -701,7 +814,14 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog @return JsonObject Object as server response */ method public JsonObject ResetDeferredLog ( input pcAblApp as character, input piPID as integer ): - return this-object:DeleteData(substitute(OEManagerEndpoint:ResetDeferredLog, pcAblApp, piPID)). + define variable oJsonResp as JsonObject no-undo. + + assign oJsonResp = this-object:DeleteData(substitute(OEManagerEndpoint:ResetDeferredLog, pcAblApp, piPID)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + else + return oJsonResp. end method. /* ResetDeferredLog */ /* Terminate an agent (ABL) session for an ABL Application @@ -715,7 +835,14 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog input piPID as integer, input piSession as integer, input piTermOpt as integer ): - return this-object:DeleteData(substitute(OEManagerEndpoint:AgentSession, pcAblApp, piPID, piSession, piTermOpt)). + define variable oJsonResp as JsonObject no-undo. + + assign oJsonResp = this-object:DeleteData(substitute(OEManagerEndpoint:AgentSession, pcAblApp, piPID, piSession, piTermOpt)). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + else + return oJsonResp. end method. /* TerminateAblSession */ /* Terminate a client (HTTP) session for an ABL Application @@ -728,12 +855,18 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog method public JsonObject TerminateClientSession ( input pcAblApp as character, input piTermOpt as integer, input pcSession as character ): - define variable cHttpUrl as character no-undo. + define variable cHttpUrl as character no-undo. + define variable oJsonResp as JsonObject no-undo. assign cHttpUrl = substitute(OEManagerEndpoint:ClientSession, pcAblApp, piTermOpt) + "&sessionID". assign cHttpUrl = substitute("&1=&2", cHttpUrl, pcSession). - return this-object:DeleteData(cHttpUrl). + assign oJsonResp = this-object:DeleteData(cHttpUrl). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + else + return oJsonResp. end method. /* TerminateClientSession */ /* Stop (terminate) a single MSAgent for an ABL Application @@ -748,13 +881,19 @@ class OpenEdge.ApplicationServer.Util.OEManagerConnection implements ISupportLog input pcAgentID as character, input piWaitFinish as character, input piWaitAfter as character ): - define variable cHttpUrl as character no-undo. + define variable cHttpUrl as character no-undo. + define variable oJsonResp as JsonObject no-undo. /* For security reasons, we use the internal AgentID to identify the MSAgent to be stopped. */ assign cHttpUrl = substitute(OEManagerEndpoint:AgentStop, pcAblApp, pcAgentID) + "?waitToFinish=" + piWaitFinish + "&waitAfterStop=" + piWaitAfter. - return this-object:DeleteData(cHttpUrl). + assign oJsonResp = this-object:DeleteData(cHttpUrl). + + if JsonPropertyHelper:HasTypedProperty(oJsonResp, "error", JsonDataType:String) then + undo, throw new Progress.Lang.AppError(oJsonResp:GetCharacter("error"), 0). + else + return oJsonResp. end method. /* StopAgent */ end class. diff --git a/PAS/Management/OEManager/ABL/utils.zip b/PAS/Management/OEManager/ABL/utils.zip index c30dafa..bbc91fa 100644 Binary files a/PAS/Management/OEManager/ABL/utils.zip and b/PAS/Management/OEManager/ABL/utils.zip differ