Skip to content

Commit

Permalink
mac_address no longer works with Docker API v1.44+. (ansible-collecti…
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein authored Jan 20, 2024
1 parent b2cee56 commit 648e065
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 40 deletions.
1 change: 1 addition & 0 deletions plugins/modules/docker_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@
mac_address:
description:
- Container MAC address (for example, V(92:d0:c6:0a:29:33)).
- Note that the global container-wide MAC address is deprecated and no longer used since Docker API version 1.44.
type: str
memory:
description:
Expand Down
82 changes: 42 additions & 40 deletions tests/integration/targets/docker_container/tasks/tests/options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3010,46 +3010,48 @@ avoid such warnings, please quote the value.' in (log_options_2.warnings | defau
## mac_address #####################################################
####################################################################

- name: mac_address
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
mac_address: 92:d0:c6:0a:29:33
state: started
register: mac_address_1

- name: mac_address (idempotency)
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
mac_address: 92:d0:c6:0a:29:33
state: started
register: mac_address_2

- name: mac_address (change)
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
mac_address: 92:d0:c6:0a:29:44
state: started
force_kill: true
register: mac_address_3

- name: cleanup
docker_container:
name: "{{ cname }}"
state: absent
force_kill: true
diff: false

- assert:
that:
- mac_address_1 is changed
- mac_address_2 is not changed
- mac_address_3 is changed
- when: docker_api_version is version('1.44', '<')
block:
- name: mac_address
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
mac_address: 92:d0:c6:0a:29:33
state: started
register: mac_address_1

- name: mac_address (idempotency)
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
mac_address: 92:d0:c6:0a:29:33
state: started
register: mac_address_2

- name: mac_address (change)
docker_container:
image: "{{ docker_test_image_alpine }}"
command: '/bin/sh -c "sleep 10m"'
name: "{{ cname }}"
mac_address: 92:d0:c6:0a:29:44
state: started
force_kill: true
register: mac_address_3

- name: cleanup
docker_container:
name: "{{ cname }}"
state: absent
force_kill: true
diff: false

- assert:
that:
- mac_address_1 is changed
- mac_address_2 is not changed
- mac_address_3 is changed

####################################################################
## memory ##########################################################
Expand Down

0 comments on commit 648e065

Please sign in to comment.