Skip to content

Commit a762dc6

Browse files
authored
Fix undesirable splitting of IPv6 host addresses (#533)
* fix: over splitting for ipv6 addresses Signed-off-by: linxside <[email protected]> * test: add test cases for ipv6 oversplitting Signed-off-by: linxside <[email protected]> Signed-off-by: linxside <[email protected]>
1 parent e394398 commit a762dc6

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

plugins/module_utils/podman/podman_container_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ def diffparam_env(self):
909909

910910
def diffparam_etc_hosts(self):
911911
if self.info['hostconfig']['extrahosts']:
912-
before = dict([i.split(":")
912+
before = dict([i.split(":", 1)
913913
for i in self.info['hostconfig']['extrahosts']])
914914
else:
915915
before = {}

tests/integration/targets/podman_container_idempotency/tasks/idem_all.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,38 @@
242242
- test18 is not changed
243243
- test19 is changed
244244

245+
- name: Run container with etc_hosts
246+
containers.podman.podman_container:
247+
executable: "{{ test_executable | default('podman') }}"
248+
image: "{{ idem_image }}"
249+
name: idempotency
250+
state: present
251+
etc_hosts:
252+
host1: 127.0.0.1
253+
host2: fd00::1
254+
command: 1h
255+
register: test20
256+
257+
- name: Check info with etc_hosts
258+
assert:
259+
that: test20 is changed
260+
261+
- name: Run container with etc_hosts again
262+
containers.podman.podman_container:
263+
executable: "{{ test_executable | default('podman') }}"
264+
image: "{{ idem_image }}"
265+
name: idempotency
266+
state: present
267+
etc_hosts:
268+
host1: 127.0.0.1
269+
host2: fd00::1
270+
command: 1h
271+
register: test21
272+
273+
- name: Check info with etc_hosts again
274+
assert:
275+
that: test21 is not changed
276+
245277
- name: Remove test container
246278
containers.podman.podman_container:
247279
executable: "{{ test_executable | default('podman') }}"

0 commit comments

Comments
 (0)