CheckPointSW / cp_mgmt_api_python_sdk

Check Point API Python Development Kit simplifies the use of the Check Point Management APIs.
Apache License 2.0
92 stars 59 forks source link

policies with ipv6 only objects break the clone_object.py #13

Closed netat closed 5 years ago

netat commented 5 years ago

https://github.com/CheckPointSW/cp_mgmt_api_python_sdk/blob/f1d7eab2a43c8df91cb7b5d9a2dec17160da108a/examples_python2/clone_host.py#L385

Hi Guys,

If there is a policy with an ipv6 only object the clone_host.py will throw a KeyError exception as the api will not return ipv4-address as part of the json response. Putting the ipv4 address check in a try statment seemed to be a good fix for the issue.

try: if host_object["ipv4-address"] != orig_host_ip: continue except KeyError: continue

chkp-amiads commented 5 years ago

@netat , thanks for your feedback. Fixed.