PaloAltoNetworks / PaloAltoNetworks/pan-os-python

Not able to commit-all with "template" and "admins"

Open
#515 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
400
Forks
199
PR merge metrics
No merged PRs in 30d

Description

When I try to commit-all with:

pano = panorama.Panorama(hostname=panohost, api_key=api_key)
cmd = panorama.PanoramaCommitAll(

        style="template",
        name=template_name,
        admins=[api_user],
)
pano.commit(cmd=cmd, sync=True, sync_all=True, exception=True)

...I get this error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/panos/base.py", line 3878, in method
    super_method(self, *args, **kwargs)
  File "/root/.local/lib/python3.6/site-packages/pan/xapi.py", line 902, in commit
    raise PanXapiError(self.status_detail)
  pan.xapi.PanXapiError:  commit-all -> template -> admin unexpected here
 commit-all -> template  is unexpected
 commit-all  is unexpected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "committest.py", line 31, in <module>
    pano.commit(cmd=cmd, sync=True, sync_all=True, exception=True)
  File "/usr/local/lib/python3.6/site-packages/panos/base.py", line 4770, in commit
    sync=sync, exception=exception, cmd=cmd, admins=admins, sync_all=sync_all
  File "/usr/local/lib/python3.6/site-packages/panos/base.py", line 4851, in _commit
    retry_on_peer=True,
  File "/usr/local/lib/python3.6/site-packages/panos/base.py", line 3899, in method
    raise the_exception
panos.errors.PanDeviceXapiError:  commit-all -> template -> admin unexpected here
 commit-all -> template  is unexpected
 commit-all  is unexpected

Am I doing something wrong, or is the API doing something wrong?

This is against a Panorama and firewalls which are all 11.0.1, and pan-os-python-1.11.0, pan-python-0.17.0.

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example against the stated PAN-OS and package versions, then inspect the commit path in panos/base.py and request handling in pan/xapi.py. Trace how template and admins are serialized for commit-all, and identify whether the generated request matches the device API. Done means the reported command succeeds or the unsupported combination is clearly rejected and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.