Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete_similar() not working in 10.1.X #510

Open
rebelfish opened this issue May 17, 2023 · 5 comments
Open

Delete_similar() not working in 10.1.X #510

rebelfish opened this issue May 17, 2023 · 5 comments
Labels

Comments

@rebelfish
Copy link

Describe the bug

A script using .delete_similar() worked against 9.1.X but was recently discovered to not be working against 10.1.7. The script has not changed. Only the PAN-OS upgrade.

Expected behavior

Cycling through a dict of DeviceGroups as keys and a list of SecurityRule objects as the value:

for dg in dictRules:
    dictRules[dg][0].delete_similar()

This would do an atomic delete per Device Group

Current behavior

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/panos/base.py", line 3878, in method
    super_method(self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pan/xapi.py", line 733, in delete
    self.__type_config('delete', query, extra_qs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pan/xapi.py", line 805, in __type_config
    raise PanXapiError(self.status_detail)
pan.xapi.PanXapiError: The request could not be handled

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#54>", line 2, in <module>
    dictDisabled[dg][0].delete_similar()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/panos/base.py", line 1993, in delete_similar
    dev.xapi.delete(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/panos/base.py", line 3899, in method
    raise the_exception
panos.errors.PanDeviceXapiError: The request could not be handled

Possible solution

Steps to reproduce

Screenshots

Context

This is part of an automation script that is used to disable a csv list of rules and then on a designated day of the month, the script is used to delete those rules if still disabled

Your Environment

Tested with multiple versions of lxml, pan-os-python, and pan-python (0.16.0, 0.17.0).

@rebelfish rebelfish added the bug label May 17, 2023
@scubar
Copy link

scubar commented Jun 23, 2023

I am seeing this same issue on 10.1.10.

Reverting back to using the standard delete() on each rule still works, albeit it is much slower than using delete_similar().

@AnthoBalitrand
Copy link
Contributor

AnthoBalitrand commented Jul 3, 2023

This is not linked to pan-os-python but to PAN-OS itself.
After getting some feedback from the TAC, the bulk delete XML API calls have been removed voluntarily starting 10.X because of some wrong behaviour on some objects caches.
It seems it has been restored (PAN-179059) on the following releases :

  • 10.0.10
  • 10.1.5
  • 10.2.2-h2

Tested on my side on 10.1.9, and it seems it's still not working... Trying to get more inputs.

@scubar
Copy link

scubar commented Jul 21, 2023

I can confirm that .delete_simillar() works as expected on 10.2.4-h3.

@scubar
Copy link

scubar commented Nov 30, 2023

delete_simillar has stopped working again on 10.2.5 and greater in the 10.x.x release train. It also does not work on 11.0.3.

@scubar
Copy link

scubar commented Dec 11, 2023

I got this feedback from Palo Alto support.

"The support for XML API requests to delete multiple security policies at one shot by, passing the policy names separated by the 'or' operator in the x-path is no longer available."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants