Some post merge clean up: (#4406)
- Removed required_if. - Fixed doc strings. - Removed debug output being appended to actions. - Put import of basics at bottom to be consistent with other docker modules - Added 'containers' alias to 'connected' param - Put facts in ansible_facts.ansible_docker_network
This commit is contained in:
parent
94486c5c77
commit
a8111adcd6
1 changed files with 4 additions and 7 deletions
|
@ -36,6 +36,8 @@ options:
|
||||||
description:
|
description:
|
||||||
- List of container names or container IDs to connect to a network.
|
- List of container names or container IDs to connect to a network.
|
||||||
default: null
|
default: null
|
||||||
|
aliases:
|
||||||
|
- containers
|
||||||
|
|
||||||
driver:
|
driver:
|
||||||
description:
|
description:
|
||||||
|
@ -157,7 +159,6 @@ facts:
|
||||||
sample: {}
|
sample: {}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
from ansible.module_utils.docker_common import *
|
from ansible.module_utils.docker_common import *
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -219,7 +220,6 @@ class DockerNetworkManager(object):
|
||||||
network = None
|
network = None
|
||||||
for n in networks:
|
for n in networks:
|
||||||
if n['Name'] == self.parameters.network_name:
|
if n['Name'] == self.parameters.network_name:
|
||||||
self.results[u'actions'].append('Found network %s' % self.parameters.network_name)
|
|
||||||
network = n
|
network = n
|
||||||
return network
|
return network
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ class DockerNetworkManager(object):
|
||||||
if not self.check_mode and not self.parameters.debug:
|
if not self.check_mode and not self.parameters.debug:
|
||||||
self.results.pop('actions')
|
self.results.pop('actions')
|
||||||
|
|
||||||
self.results['facts'] = self.get_existing_network()
|
self.results['ansible_facts'] = {u'ansible_docker_network': self.get_existing_network()}
|
||||||
|
|
||||||
def absent(self):
|
def absent(self):
|
||||||
self.remove_network()
|
self.remove_network()
|
||||||
|
@ -355,7 +355,7 @@ class DockerNetworkManager(object):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
network_name = dict(type='str', required=True, aliases=['name']),
|
network_name = dict(type='str', required=True, aliases=['name']),
|
||||||
connected = dict(type='list', default=[]),
|
connected = dict(type='list', default=[], aliases=['containers']),
|
||||||
state = dict(type='str', default='present', choices=['present', 'absent']),
|
state = dict(type='str', default='present', choices=['present', 'absent']),
|
||||||
driver = dict(type='str', default='bridge'),
|
driver = dict(type='str', default='bridge'),
|
||||||
driver_options = dict(type='dict', default={}),
|
driver_options = dict(type='dict', default={}),
|
||||||
|
@ -366,11 +366,8 @@ def main():
|
||||||
debug = dict(type='bool', default=False)
|
debug = dict(type='bool', default=False)
|
||||||
)
|
)
|
||||||
|
|
||||||
required_if = []
|
|
||||||
|
|
||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
required_if=required_if,
|
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue