Fix dockerng.network_* ignoring of tests=True

Fixes #41976
This commit is contained in:
Andrew Bulford 2017-06-28 15:59:17 +01:00
parent fc551bcf5d
commit 1cc2aa503a

View file

@ -2123,6 +2123,11 @@ def network_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__['dockerng.create_network'](
name, driver=driver)
@ -2169,6 +2174,11 @@ def network_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__['dockerng.disconnect_container_from_network'](container, name)