def network_absent(name, driver=None):
 ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
 networks = __salt__['dockerng.networks'](names=[name])
 if (not networks):
  ret['result'] = True
  ret['comment'] = "Network '{0}' already absent".format(name)
  return ret
 for container in networks[0]['Containers']:
  try:
   ret['changes']['disconnected'] = __salt__['dockerng.disconnect_container_from_network'](container, name)
  except Exception as exc:
   ret['comment'] = "Failed to disconnect container '{0}' to network '{1}' {2}".format(container, name, exc)
 try:
  ret['changes']['removed'] = __salt__['dockerng.remove_network'](name)
  ret['result'] = True
 except Exception as exc:
  ret['comment'] = "Failed to remove network '{0}': {1}".format(name, exc)
 return ret

def network_absent ( name , driver = None ) : ret = { 'name' : name , 'changes' : { } , 'result' : False , 'comment' : '' } networks = __salt__ [ 'dockerng.networks' ] ( names = [ name ] ) if ( not networks ) : ret [ 'result' ] = True ret [ 'comment' ] = "Network '{0}' already absent" . format ( name ) return ret for container in networks [ 0 ] [ 'Containers' ] : try : ret [ 'changes' ] [ 'disconnected' ] = __salt__ [ 'dockerng.disconnect_container_from_network' ] ( container , name ) except Exception as exc : ret [ 'comment' ] = "Failed to disconnect container '{0}' to network '{1}' {2}" . format ( container , name , exc ) try : ret [ 'changes' ] [ 'removed' ] = __salt__ [ 'dockerng.remove_network' ] ( name ) ret [ 'result' ] = True except Exception as exc : ret [ 'comment' ] = "Failed to remove network '{0}': {1}" . format ( name , exc ) return ret
ensure that a network is absent .