1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-05-02 13:52:49 +00:00

Convert IPv6 to shorten form (#232)

This commit is contained in:
Sergey 2021-04-02 03:01:50 +03:00 committed by GitHub
parent b098abb00f
commit 46020ecf80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 7 deletions

View file

@ -163,6 +163,11 @@ network:
import json # noqa: F402
from distutils.version import LooseVersion # noqa: F402
import os # noqa: F402
try:
import ipaddress
HAS_IP_ADDRESS_MODULE = True
except ImportError:
HAS_IP_ADDRESS_MODULE = False
from ansible.module_utils.basic import AnsibleModule # noqa: F402
from ansible.module_utils._text import to_bytes, to_native # noqa: F402
@ -372,6 +377,8 @@ class PodmanNetworkDiff:
after = before
if self.params['subnet'] is not None:
after = self.params['subnet']
if HAS_IP_ADDRESS_MODULE:
after = ipaddress.ip_network(after).compressed
return self._diff_update_and_compare('subnet', before, after)
def diffparam_macvlan(self):