def merge_volume_bindings(volumes, previous_container):
 affinity = {}
 volume_bindings = dict((build_volume_binding(volume) for volume in volumes if volume.external))
 if previous_container:
  old_volumes = get_container_data_volumes(previous_container, volumes)
  warn_on_masked_volume(volumes, old_volumes, previous_container.service)
  volume_bindings.update((build_volume_binding(volume) for volume in old_volumes))
  if old_volumes:
   affinity = {u'affinity:container': (u'=' + previous_container.id)}
 return (list(volume_bindings.values()), affinity)

def merge_volume_bindings ( volumes , previous_container ) : affinity = { } volume_bindings = dict ( ( build_volume_binding ( volume ) for volume in volumes if volume . external ) ) if previous_container : old_volumes = get_container_data_volumes ( previous_container , volumes ) warn_on_masked_volume ( volumes , old_volumes , previous_container . service ) volume_bindings . update ( ( build_volume_binding ( volume ) for volume in old_volumes ) ) if old_volumes : affinity = { u'affinity:container' : ( u'=' + previous_container . id ) } return ( list ( volume_bindings . values ( ) ) , affinity )
return a list of volume bindings for a container .