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:
parent
b098abb00f
commit
46020ecf80
2 changed files with 35 additions and 7 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue