policies.SecurityRule().clone??

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

policies.SecurityRule().clone??

L1 Bithead

I'm having a terrible time trying to just simply 'clone' a security rule, and then edit it how desired, without running into issues.

 

First, using copy.deepcopy(security_rule) works perfectly...however adds a massive amount of run-time to my program. I previously used this method on dictionaries without a major increase in run-time. I can't find any existing clone/duplicate/etc type of function within the API, if it exists.


I've tried using element(), element_str(), __dict__, manually converting to dict, I've tried manually grabbing all the params that are allowed when creating a new rule via a dict (ie SecurityRule(**dict))...and spent hours running into misc issue after issue. Either rules not getting added correctly, or rules still somehow magically linked (old vs new rule) even when creating a brand new one via **dict. The linkage then causes the old rule to get modified when only attempting to modify the new rule.

 

There's got to be a simple way to do this. I'm hoping someone can help me out here.

 

Thanks.

0 REPLIES 0
  • 1760 Views
  • 0 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!