Skip to content

Commit

Permalink
feat: Handling Log Collector Group (LCG) pushes (#493)
Browse files Browse the repository at this point in the history
* feat: Handling LCG pushes

* Fix formatting
  • Loading branch information
jamesholland-uk committed Feb 7, 2024
1 parent 173bb8a commit 7e87952
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions panos/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4901,6 +4901,26 @@ def _commit(
if exception:
raise err.PanCommitNotNeeded("Commit not needed", pan_device=self)
else:
# By getting here, there was no "./result/job" in the commit response,
# and there was no exception raised either, so capture the response message
commit_response_msg = commit_response.find("./msg/line").text
self._logger.debug("No job id. Msg: " + commit_response_msg)

# One scenario for arriving here in the the code is pushing to Log Collector Groups (LCG),
# they don't have a job ID, so test for the relevant message to see if this is the case
if (
"Generated config and committed to connected collectors in group"
in commit_response_msg
):
# With no real job ID to return, construct a reasonable response.
# There is currently no way to check the push to LCG was a success, so assume it was
log_collector_group_push_result = {
"success": True,
"result": "Ok",
"jobid": "0",
"messages": [commit_response_msg],
}
return log_collector_group_push_result
return
if not sync:
# Don't synchronize, just return
Expand Down

0 comments on commit 7e87952

Please sign in to comment.