def _attach_volume(module, profitbricks, datacenter, volume):
 server = module.params.get('server')
 if server:
  if (not uuid_match.match(server)):
   server_list = profitbricks.list_servers(datacenter)
   for s in server_list['items']:
    if (server == s['properties']['name']):
     server = s['id']
     break
  try:
   return profitbricks.attach_volume(datacenter, server, volume)
  except Exception:
   e = get_exception()
   module.fail_json(msg=('failed to attach volume: %s' % str(e)))

def _attach_volume ( module , profitbricks , datacenter , volume ) : server = module . params . get ( 'server' ) if server : if ( not uuid_match . match ( server ) ) : server_list = profitbricks . list_servers ( datacenter ) for s in server_list [ 'items' ] : if ( server == s [ 'properties' ] [ 'name' ] ) : server = s [ 'id' ] break try : return profitbricks . attach_volume ( datacenter , server , volume ) except Exception : e = get_exception ( ) module . fail_json ( msg = ( 'failed to attach volume: %s' % str ( e ) ) )
attaches a volume .