Skip to content

Commit

Permalink
mac_address no longer works with Docker API v1.44+. (#764)
Browse files Browse the repository at this point in the history
(cherry picked from commit 648e065)
  • Loading branch information
felixfontein committed Jan 20, 2024
1 parent 7a7494a commit 4c74dd6
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 @@ -469,6 +469,7 @@
mac_address:
description:
- Container MAC address (for example, C(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 @@ -2744,46 +2744,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: yes
register: mac_address_3

- name: cleanup
docker_container:
name: "{{ cname }}"
state: absent
force_kill: yes
diff: no

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

Please sign in to comment.