Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.7] Fix advertise addr #48405

Merged
merged 2 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/47608-docker_swarm-advertise_addr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- "docker_swarm - making ``advertise_addr`` optional, as it was already documented."
4 changes: 0 additions & 4 deletions lib/ansible/modules/cloud/docker/docker_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
- name: Init a new swarm with default parameters
docker_swarm:
state: present
advertise_addr: 192.168.1.1

- name: Update swarm configuration
docker_swarm:
Expand Down Expand Up @@ -330,9 +329,6 @@ def init_swarm(self):
return

try:
if self.parameters.advertise_addr is None:
self.client.fail(msg="advertise_addr is required to initialize a swarm cluster.")

self.client.init_swarm(
advertise_addr=self.parameters.advertise_addr, listen_addr=self.parameters.listen_addr,
force_new_cluster=self.parameters.force_new_cluster, swarm_spec=self.parameters.spec)
Expand Down
14 changes: 3 additions & 11 deletions test/integration/targets/docker_swarm/tasks/test_swarm.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
- name: Test parameters with state=present
- name: Make sure we're not already using Docker swarm
docker_swarm:
state: present
ignore_errors: yes
register: output

- name: assert failure when called with state=init and no advertise_addr
assert:
that:
- 'output.failed'
- 'output.msg == "advertise_addr is required to initialize a swarm cluster."'
state: absent
force: true

- name: Test parameters with state=join
docker_swarm:
Expand Down Expand Up @@ -37,7 +30,6 @@
- name: Create a Swarm cluster
docker_swarm:
state: present
advertise_addr: "{{ansible_default_ipv4.address}}"
register: output

- name: assert changed when create a new swarm cluster
Expand Down