JSON Output for Patch Notification Utility

763
0
05-24-2020 10:58 AM
Status: Open
BrettFrahm
Occasional Contributor II

Our organization currently uses the "Check for Arcgis Enterprise Updates" tool A.K.A the Patch Notification Utility to figure out what patches are needed for each of servers/portals/data stores. Using the subprocess library we have scheduled python scripts that run the command  "patchnotification.bat -c all " , which gives us a string output that then emails administrators about new patches and we would like to do other things with it too if it was easier to manage.

The problem with this setup is that the string output is terrible to work with and I absolutely hate working with regex patterns. If there was a way to have a simple JSON output, I could categorize things a million times easier and make a half decent automation.

Here is an example of how to get the string output with Python

import subprocess

bat_file = "*********"
output = subprocess.check_output(bat_file)
print(str(output))

Here is what the string output looks like.

\r\n================================================================================\r\n                      ArcGIS Enterprise Patch Notification\n================================================================================\r\n\r\nInstalled Components\r\n\r\n    ArcGIS GeoEvent Server                        10.8\r\n    ArcGIS Server                                 10.8\r\n\r\n================================================================================\r\n\r\nAvailable Updates\r\n\r\n ArcGIS GeoEvent Server\r\n    (no updates available)\r\n\r\n ArcGIS Server\r\n    - ArcGIS Server 10.8 Utility Network Update Subnetwork Patch\n      https://support.esri.com/download/7795\n      Release Date: 4/9/20\n\r\n================================================================================\r\n\r\nInstalled Patches\r\n    - ArcGIS Server 10.8 SQL Server Enterprise Geodatabase Upgrade Patch\n    - ArcGIS GeoEvent Server 10.8 Patch 1\n\r\n================================================================================\r\nTo browse a full list of Esri patches and service packs, visit the Esri Support site:\r\nhttp://support.esri.com/Downloads\r\n'

Dorothy Ho

Hilary Curtis