Skip to content

Commit

Permalink
Fixed duplicate host IP in URL for commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hknutzen committed Oct 9, 2024
1 parent 6c584ce commit e95371f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{{$NEXT}}

- Fixed URL for committing changes to device of type PAN-OS.
Previously the URL looked like
https://address/api/?key=xxx&https://address/api/?key=xxx&type=commit

3.034 2024-10-04 10:26:33+02:00 Europe/Berlin

- For device of type ASA that has interface not known by Netspoc,
Expand Down
6 changes: 2 additions & 4 deletions go/pkg/panos/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ func (s *State) ApplyCommands(logFH *os.File) error {
return parseResponse(body)
}
commit := func() error {
cmd := s.urlPrefix +
"type=commit&action=partial&cmd=<commit><partial><admin><member>" +
cmd := "type=commit&action=partial&cmd=<commit><partial><admin><member>" +
s.devUser + "</member></admin></partial></commit>"
msg, data, err := doCmd(cmd)
if err != nil {
Expand All @@ -227,8 +226,7 @@ func (s *State) ApplyCommands(logFH *os.File) error {
if !simulated {
time.Sleep(10 * time.Second)
}
cmd := s.urlPrefix +
"type=op&cmd=<show><jobs><id>" + id + "</id></jobs></show>"
cmd := "type=op&cmd=<show><jobs><id>" + id + "</id></jobs></show>"
_, data, err := doCmd(cmd)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions go/testdata/pan-os_simul.t
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ TESTSERVER/api/?key=xxx&action=set&type=config&xpath=/config/devices/entry[@name
TESTSERVER/api/?key=xxx&action=set&type=config&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='r1']&element=<action>allow</action><from><member>z1</member></from><to><member>z2</member></to><source><member>any</member></source><destination><member>any</member></destination><service><member>tcp 80</member></service><application><member>any</member></application><rule-type>interzone</rule-type>
<response status="success" code="20"></response>

TESTSERVER/api/?key=xxx&TESTSERVER/api/?key=xxx&type=commit&action=partial&cmd=<commit><partial><admin><member>admin</member></admin></partial></commit>
TESTSERVER/api/?key=xxx&type=commit&action=partial&cmd=<commit><partial><admin><member>admin</member></admin></partial></commit>
<response status="success" code="19"><result><job>6</job></result></response>

TESTSERVER/api/?key=xxx&TESTSERVER/api/?key=xxx&type=op&cmd=<show><jobs><id>6</id></jobs></show>
TESTSERVER/api/?key=xxx&type=op&cmd=<show><jobs><id>6</id></jobs></show>
<response status="success"><result><job>
<result>OK</result>
</job></result></response>
Expand Down

0 comments on commit e95371f

Please sign in to comment.