PaloAltoNetworks / pan-os-php

Framework and utilities to easily manage and edit Palo Alto Network PANOS devices
ISC License
72 stars 15 forks source link

New zone can't be added to rules unless it already exists in a rule #786

Closed bethatasitmay closed 10 months ago

bethatasitmay commented 10 months ago

Describe the bug

I added 2 new zones in the GUI, but when I try to add them to rule (from-Add/to-Add) it fails stating the zone doesn't exist. If I manually add the zones to at least one rule, the command will work. I didn't try the force option.

Expected behavior

A new zone should be added to a rule without having to manually adding to a rule first.

Current behavior

I get an error:

PS C:\tools\pan> php -r "require_once 'C:/tools/pan/pan-os-php/utils/pan-os-php.php';" type=rule in=api://panorama.domain.com location=DG1 actions=to-Add:NewZone 'filter=(to has ExistingZone)'


*** pan-os-php.php type=rule UTILITY **

Possible solution

Maybe in this situation the force option is required. If not, make it so I don't have to manually add a new zone to a rule for the command to work.

Steps to reproduce

See PowerShell command under Current Behavior

After failure, if I manually add NewZone to a rule (I only added it to one) and commit to Panorama (I don't know if the commit step is necessary), the command works and adds it to the remaining rules.

Context

I have new zones to add to our rules. Today was the first time trying to add a new zone that wasn't already in a rule.

Your Environment

swaschkut commented 10 months ago

as Panorama DeviceGroup is specific, you can directly add zone information without creating a real Zone object in template in Panorama GUI;

explicit therefor as mentioned in the pan-os-php script: "zone named 'NewZone' not found, you can try to use xxx-add-force action instead"

please use:

....in=api://panorama.domain.com location=DG1 actions=to-Add-force:NewZone 'filter=(to has ExistingZone)'

bethatasitmay commented 10 months ago

ok, thanks!