Giter VIP home page Giter VIP logo

Comments (6)

rsaturns avatar rsaturns commented on September 18, 2024

I'm seeing the same issue trying to pass the following delete debug-log mp-log file *.1 the asterisk isn't being seen as just text but instead being interpreted.

Thank's to someone else's efforts:

So a little bit of context on this issue if you wanted to add it to your comments. The root on this issue is in pan-python. Specifically https://github.com/kevinsteves/pan-python/blob/master/lib/pan/xapi.py#L586

From your command, it is generating '<delete><debug-log><mp-log><file><*.1></*.1></file></mp-log></debug-log></delete>' which is invalid of course. It would need to generate '<delete><debug-log><mp-log><file>"*.1"</file></mp-log></debug-log></delete>'

from ansible-pan.

arkaraung1993 avatar arkaraung1993 commented on September 18, 2024

Hi zer0nimbus,

I am also facing this issue in "panos_op" module.

using command is "test security-policy-match source 10.0.0.111 destination 2.2.2.2 destination-port 443 protocol 6"

Error message:

UnboundLocalError: local variable 'xml_output' referenced before assignment

fatal: [10.88.10.104]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_NwWQek/ansible_module_panos_op.py", line 159, in \n main()\n File "/tmp/ansible_NwWQek/ansible_module_panos_op.py", line 152, in main\n obj_dict = xmltodict.parse(xml_output)\nUnboundLocalError: local variable 'xml_output' referenced before assignment\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 1
}


I try to understand your explanation change in code, but i am not understand what you change in code.
Could you help me to explain again.

Really appreciate if you help on this issue.

from ansible-pan.

AndoJG avatar AndoJG commented on September 18, 2024

arkaraung1993 -

I have not yet been able to fix this issue. Sorry if I did not make that clear in my initial post.

from ansible-pan.

amsinha2 avatar amsinha2 commented on September 18, 2024

Is there a fix for this yet?

from ansible-pan.

shinmog avatar shinmog commented on September 18, 2024

@zer0nimbus
As it turns out, depending on the command you're attempting to run, you could get one of a few different errors from PAN-OS. It seems like it's best to just always try to run the command a second time, because in your case of trying to run show interface ethernet1/12, running it the second way would actually work. So I'm going to update the code to do that.

@arkaraung1993
This module will not in its current form work for that particular command. The op command expects XML as its input, and in this case, the current code would try the following:

<test><security-policy-match><source><10.0.0.111><destination><2.2.2.2><destination-port><443><protocol><6></6></protocol></443></destination-port></2.2.2.2></destination></10.0.0.111></source></security-policy-match></test>

...and when that doesn't work, it will try this:

<test><security-policy-match><source><10.0.0.111><destination><2.2.2.2><destination-port><443><protocol>6</protocol></443></destination-port></2.2.2.2></destination></10.0.0.111></source></security-policy-match></test>

..But what it actually needs to execute is this:

<test><security-policy-match><source>10.0.0.111</source><destination>2.2.2.2</destination><destination-port>443</destination-port><protocol>6</protocol></security-policy-match></test>

I'll open a PR which should solve all of these issues.

from ansible-pan.

shinmog avatar shinmog commented on September 18, 2024

This updated panos_op will allow you to give the command as XML if it's more complicated than just a single "back-off", as is the "test security-policy-match" use case above. So you can specify the entire XML, then tell panos_op that it's XML already, so there's no need to try and fiddle with it.

from ansible-pan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.