def migrate_location_credentials(migrate_engine, to_quoted):
 meta = sqlalchemy.schema.MetaData()
 meta.bind = migrate_engine
 images_table = sqlalchemy.Table('images', meta, autoload=True)
 images = list(images_table.select(images_table.c.location.startswith('swift')).execute())
 for image in images:
  try:
   fixed_uri = legacy_parse_uri(image['location'], to_quoted)
   images_table.update().where((images_table.c.id == image['id'])).values(location=fixed_uri).execute()
  except exception.BadStoreUri as e:
   reason = encodeutils.exception_to_unicode(e)
   msg = (_LE('Invalid store uri for image: %(image_id)s. Details: %(reason)s') % {'image_id': image.id, 'reason': reason})
   LOG.exception(msg)
   raise

def migrate_location_credentials ( migrate_engine , to_quoted ) : meta = sqlalchemy . schema . MetaData ( ) meta . bind = migrate_engine images_table = sqlalchemy . Table ( 'images' , meta , autoload = True ) images = list ( images_table . select ( images_table . c . location . startswith ( 'swift' ) ) . execute ( ) ) for image in images : try : fixed_uri = legacy_parse_uri ( image [ 'location' ] , to_quoted ) images_table . update ( ) . where ( ( images_table . c . id == image [ 'id' ] ) ) . values ( location = fixed_uri ) . execute ( ) except exception . BadStoreUri as e : reason = encodeutils . exception_to_unicode ( e ) msg = ( _LE ( 'Invalid store uri for image: %(image_id)s. Details: %(reason)s' ) % { 'image_id' : image . id , 'reason' : reason } ) LOG . exception ( msg ) raise
migrate location credentials for encrypted swift uris between the quoted and unquoted forms .