def fix_wrong_volume_attachments(meta, wrong_attachments, fix_limit):
    if (len(wrong_attachments) <= int(fix_limit)):
        volume_attachment_t = Table('volume_attachment', meta, autoload=True)
        for volume_attachment_id in wrong_attachments:
            log.info('-- action: deleting volume attachment id: %s', volume_attachment_id)
            now = datetime.datetime.utcnow()
            delete_volume_attachment_q = volume_attachment_t.update().where((volume_attachment_t.c.id == volume_attachment_id)).values(updated_at=now, deleted_at=now, deleted=1)
            delete_volume_attachment_q.execute()
    else:
        log.warn('- PLEASE CHECK MANUALLY - too many (more than %s) wrong volume attachments - denying to fix them automatically', str(fix_limit))
def fix_wrong_volume_attachments(meta, wrong_attachments, fix_limit):
    if (len(wrong_attachments) <= int(fix_limit)):
        volume_attachment_t = Table('volume_attachment', meta, autoload=True)
        for volume_attachment_id in wrong_attachments:
            log.info('-- action: deleting volume attachment id: %s', volume_attachment_id)
            now = datetime.datetime.utcnow()
            delete_volume_attachment_q = volume_attachment_t.update().where((volume_attachment_t.c.id == volume_attachment_id)).values(updated_at=now, deleted_at=now, deleted=1)
            delete_volume_attachment_q.execute()
    else:
        log.warn('- PLEASE CHECK MANUALLY - too many (more than %s) wrong volume attachments - denying to fix them automatically', str(fix_limit))