Skip to content

Commit 7e87952

Browse files
feat: Handling Log Collector Group (LCG) pushes (#493)
* feat: Handling LCG pushes * Fix formatting
1 parent 173bb8a commit 7e87952

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

panos/base.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,6 +4901,26 @@ def _commit(
49014901
if exception:
49024902
raise err.PanCommitNotNeeded("Commit not needed", pan_device=self)
49034903
else:
4904+
# By getting here, there was no "./result/job" in the commit response,
4905+
# and there was no exception raised either, so capture the response message
4906+
commit_response_msg = commit_response.find("./msg/line").text
4907+
self._logger.debug("No job id. Msg: " + commit_response_msg)
4908+
4909+
# One scenario for arriving here in the the code is pushing to Log Collector Groups (LCG),
4910+
# they don't have a job ID, so test for the relevant message to see if this is the case
4911+
if (
4912+
"Generated config and committed to connected collectors in group"
4913+
in commit_response_msg
4914+
):
4915+
# With no real job ID to return, construct a reasonable response.
4916+
# There is currently no way to check the push to LCG was a success, so assume it was
4917+
log_collector_group_push_result = {
4918+
"success": True,
4919+
"result": "Ok",
4920+
"jobid": "0",
4921+
"messages": [commit_response_msg],
4922+
}
4923+
return log_collector_group_push_result
49044924
return
49054925
if not sync:
49064926
# Don't synchronize, just return

0 commit comments

Comments
 (0)