Skip to content

Commit

Permalink
add a destination for the move multi-config for unfixed versions of p…
Browse files Browse the repository at this point in the history
…an-os
  • Loading branch information
shinmog committed Apr 15, 2024
1 parent 6423893 commit 474b86c
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions policies/rules/security/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,18 @@ func (s *Service) MoveGroup(ctx context.Context, loc Location, position rule.Pos
}
}

// Some versions of PAN-OS require that the destination always be set.
var dst string
if !vn.Gte(util.FixedPanosVersionForMultiConfigMove) {
dst = "top"
}

updates.Add(&xmlapi.Config{
Action: "move",
Xpath: util.AsXpath(path),
Where: "top",
Target: s.client.GetTarget(),
Action: "move",
Xpath: util.AsXpath(path),
Where: "top",
Destination: dst,
Target: s.client.GetTarget(),
})

baseIndex = 0
Expand Down Expand Up @@ -452,11 +459,18 @@ func (s *Service) MoveGroup(ctx context.Context, loc Location, position rule.Pos
}
}

// Some versions of PAN-OS require that the destination always be set.
var dst string
if !vn.Gte(util.FixedPanosVersionForMultiConfigMove) {
dst = "bottom"
}

updates.Add(&xmlapi.Config{
Action: "move",
Xpath: util.AsXpath(path),
Where: "bottom",
Target: s.client.GetTarget(),
Action: "move",
Xpath: util.AsXpath(path),
Where: "bottom",
Destination: dst,
Target: s.client.GetTarget(),
})

baseIndex = len(listing) - 1
Expand Down

0 comments on commit 474b86c

Please sign in to comment.