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

Add purge_networks arg to docker driver #1543

Merged
merged 1 commit into from
Feb 27, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions molecule/driver/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class Docker(base.Base):
- name: foo
- name: bar
network_mode: host
purge_networks: true
decentral1se marked this conversation as resolved.
Show resolved Hide resolved
docker_host: tcp://localhost:12376
env:
FOO: bar
Expand Down
3 changes: 3 additions & 0 deletions molecule/model/schema_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ def pre_validate_base_schema(env, keep_string):
'network_mode': {
'type': 'string',
},
'purge_networks': {
'type': 'boolean',
}
}
}
},
Expand Down
1 change: 1 addition & 0 deletions molecule/provisioner/ansible/playbooks/docker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
ulimits: "{{ item.ulimits | default(omit) }}"
networks: "{{ item.networks | default(omit) }}"
network_mode: "{{ item.network_mode | default(omit) }}"
purge_networks: "{{ item.purge_networks | default(omit) }}"
dns_servers: "{{ item.dns_servers | default(omit) }}"
env: "{{ item.env | default(omit) }}"
restart_policy: "{{ item.restart_policy | default(omit) }}"
Expand Down
1 change: 1 addition & 0 deletions test/resources/playbooks/docker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
ulimits: "{{ item.ulimits | default(omit) }}"
networks: "{{ item.networks | default(omit) }}"
network_mode: "{{ item.network_mode | default(omit) }}"
purge_networks: "{{ item.purge_networks | default(omit) }}"
dns_servers: "{{ item.dns_servers | default(omit) }}"
env: "{{ item.env | default(omit) }}"
restart_policy: "{{ item.restart_policy | default(omit) }}"
Expand Down
4 changes: 4 additions & 0 deletions test/unit/model/v2/test_platforms_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def _model_platforms_docker_section_data():
],
'network_mode':
'mode',
'purge_networks':
True,
'foo':
'bar'
}]
Expand Down Expand Up @@ -161,6 +163,7 @@ def _model_platforms_docker_errors_section_data():
},
],
'network_mode': int(),
'purge_networks': int(),
}]
}

Expand Down Expand Up @@ -213,6 +216,7 @@ def test_platforms_docker_has_errors(_config):
}]
}],
'network_mode': ['must be of string type'],
'purge_networks': ['must be of boolean type'],
'ulimits': [{
0: ['must be of string type']
}],
Expand Down