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
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