Merge pull request #41977 from redmatter/fix-dockerng-network-ignores-test

Fix dockerng.network_* ignoring of tests=True
This commit is contained in:
Nicole Thomas 2017-08-11 14:37:19 -04:00 committed by GitHub
commit c15d0034fe

View file

@ -2273,6 +2273,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)
@ -2332,6 +2337,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)