Fix dockerng.network_* ignoring of tests=True

Fixes #41976
This commit is contained in:
Andrew Bulford 2017-06-29 13:47:42 +01:00
parent aeb82f0829
commit d38199f04f

View File

@ -109,6 +109,10 @@ def present(name, driver=None, containers=None):
ret['result'] = result
else:
if __opts__['test']:
ret['result'] = None
ret['comment'] = ('The network \'{0}\' will be created'.format(name))
return ret
try:
ret['changes']['created'] = __salt__['docker.create_network'](
name, driver=driver)
@ -155,6 +159,11 @@ def absent(name, driver=None):
ret['comment'] = 'Network \'{0}\' already absent'.format(name)
return ret
if __opts__['test']:
ret['result'] = None
ret['comment'] = ('The network \'{0}\' will be removed'.format(name))
return ret
for container in networks[0]['Containers']:
try:
ret['changes']['disconnected'] = __salt__['docker.disconnect_container_from_network'](container, name)