)]}'
{"barbican/model/migration/alembic_migrations/versions/1bc885808c76_add_project_id_to_secrets.py":[{"author":{"_account_id":1091,"name":"Arun Kant","email":"arukant@cisco.com","username":"arunkant-uws"},"change_message_id":"0ac61d2f30e2bf69c31ef8f4029866c024b49b7e","unresolved":false,"context_lines":[{"line_number":21,"context_line":"                    unique\u003dFalse)"},{"line_number":22,"context_line":"    op.create_foreign_key(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, \u0027projects\u0027,"},{"line_number":23,"context_line":"                          [\u0027project_id\u0027], [\u0027id\u0027])"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"def downgrade():"},{"line_number":27,"context_line":"    op.drop_constraint(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, type_\u003d\u0027foreignkey\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"9af37de9_6e3173a2","line":24,"updated":"2015-05-11 16:03:10.000000000","message":"Is there plan to migrate project secret data to new foreign key column for existing secrets? Otherwise queries/filters need to pull data from two tables which can be confusing.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"4482b966e18884d743882a493977934e4b15a5e1","unresolved":false,"context_lines":[{"line_number":21,"context_line":"                    unique\u003dFalse)"},{"line_number":22,"context_line":"    op.create_foreign_key(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, \u0027projects\u0027,"},{"line_number":23,"context_line":"                          [\u0027project_id\u0027], [\u0027id\u0027])"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"def downgrade():"},{"line_number":27,"context_line":"    op.drop_constraint(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, type_\u003d\u0027foreignkey\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_4bb8f62a","line":24,"in_reply_to":"3afb71cf_45cee863","updated":"2015-06-11 16:19:15.000000000","message":"I believe so.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"cedddae46dd9aee3dbc4def46fb9b4ccc860d9cd","unresolved":false,"context_lines":[{"line_number":21,"context_line":"                    unique\u003dFalse)"},{"line_number":22,"context_line":"    op.create_foreign_key(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, \u0027projects\u0027,"},{"line_number":23,"context_line":"                          [\u0027project_id\u0027], [\u0027id\u0027])"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"def downgrade():"},{"line_number":27,"context_line":"    op.drop_constraint(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, type_\u003d\u0027foreignkey\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_45cee863","line":24,"in_reply_to":"3afb71cf_bf53756a","updated":"2015-06-10 10:47:36.000000000","message":"John, So should I pospone the migration of secrets to the new schema to another CR?","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"40f23fbb432f17909b93a0852f5c817bea5c2928","unresolved":false,"context_lines":[{"line_number":21,"context_line":"                    unique\u003dFalse)"},{"line_number":22,"context_line":"    op.create_foreign_key(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, \u0027projects\u0027,"},{"line_number":23,"context_line":"                          [\u0027project_id\u0027], [\u0027id\u0027])"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"def downgrade():"},{"line_number":27,"context_line":"    op.drop_constraint(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, type_\u003d\u0027foreignkey\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_bf53756a","line":24,"in_reply_to":"7ad8896b_8895cb41","updated":"2015-06-10 05:30:36.000000000","message":"For zero-downtime, I believe this software would need to be able to handle both old and new schema changes, then a follow-on CR would migrate secrets to the new association, then yet another CR would remove those old associations and clean up the code to only do new association.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"aab74b5ab42aab19bc0d385643398105307bffb4","unresolved":false,"context_lines":[{"line_number":21,"context_line":"                    unique\u003dFalse)"},{"line_number":22,"context_line":"    op.create_foreign_key(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, \u0027projects\u0027,"},{"line_number":23,"context_line":"                          [\u0027project_id\u0027], [\u0027id\u0027])"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"def downgrade():"},{"line_number":27,"context_line":"    op.drop_constraint(\u0027secrets_project_fk\u0027, \u0027secrets\u0027, type_\u003d\u0027foreignkey\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7ad8896b_8895cb41","line":24,"in_reply_to":"9af37de9_6e3173a2","updated":"2015-05-11 19:00:17.000000000","message":"That was going to be done in a subsequent CR. Though John suggested the migration go into this one. So I\u0027ll probably upload a new version of this tomorrow.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"}],"barbican/model/repositories.py":[{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"40f23fbb432f17909b93a0852f5c817bea5c2928","unresolved":false,"context_lines":[{"line_number":594,"context_line":"        utcnow \u003d timeutils.utcnow()"},{"line_number":595,"context_line":""},{"line_number":596,"context_line":"        query \u003d session.query(models.Secret)"},{"line_number":597,"context_line":"        query \u003d query.order_by(models.Secret.created_at)"},{"line_number":598,"context_line":"        query \u003d query.filter_by(deleted\u003dFalse)"},{"line_number":599,"context_line":""},{"line_number":600,"context_line":"        # Note(john-wood-w): SQLAlchemy requires \u0027\u003d\u003d None\u0027 below,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_c4ad4f85","line":597,"updated":"2015-06-10 05:30:36.000000000","message":"chellygel asked a good question: do we need to order by created date, or is it sufficient to just return the list of secrets in the database\u0027 order (the inserted date for Postgres anyway)? It seems like the specific ordering is not as important, and it makes the query more efficient as well.\n\nAnother benefit is that the _filter_by_project_id_and_join() could support paged queries with a mix of old secrets (using ProjectSecret) and new secrets (with direct assoc). I\u0027ll add that as a cover comment.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"cedddae46dd9aee3dbc4def46fb9b4ccc860d9cd","unresolved":false,"context_lines":[{"line_number":594,"context_line":"        utcnow \u003d timeutils.utcnow()"},{"line_number":595,"context_line":""},{"line_number":596,"context_line":"        query \u003d session.query(models.Secret)"},{"line_number":597,"context_line":"        query \u003d query.order_by(models.Secret.created_at)"},{"line_number":598,"context_line":"        query \u003d query.filter_by(deleted\u003dFalse)"},{"line_number":599,"context_line":""},{"line_number":600,"context_line":"        # Note(john-wood-w): SQLAlchemy requires \u0027\u003d\u003d None\u0027 below,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_e5bef4ac","line":597,"in_reply_to":"3afb71cf_c4ad4f85","updated":"2015-06-10 10:47:36.000000000","message":"I guess the ordering really isn\u0027t as important. Though I\u0027m not sure if this would be needed for MySQL?","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"4482b966e18884d743882a493977934e4b15a5e1","unresolved":false,"context_lines":[{"line_number":594,"context_line":"        utcnow \u003d timeutils.utcnow()"},{"line_number":595,"context_line":""},{"line_number":596,"context_line":"        query \u003d session.query(models.Secret)"},{"line_number":597,"context_line":"        query \u003d query.order_by(models.Secret.created_at)"},{"line_number":598,"context_line":"        query \u003d query.filter_by(deleted\u003dFalse)"},{"line_number":599,"context_line":""},{"line_number":600,"context_line":"        # Note(john-wood-w): SQLAlchemy requires \u0027\u003d\u003d None\u0027 below,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_2be37a35","line":597,"in_reply_to":"3afb71cf_e5bef4ac","updated":"2015-06-11 16:19:15.000000000","message":"I think the issue here is the expectation of an order, unless one specifically supplies criteria for that order (such as order by date, order by name, etc.).","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"40f23fbb432f17909b93a0852f5c817bea5c2928","unresolved":false,"context_lines":[{"line_number":613,"context_line":"        if secret_type:"},{"line_number":614,"context_line":"            query \u003d query.filter(models.Secret.secret_type \u003d\u003d secret_type)"},{"line_number":615,"context_line":""},{"line_number":616,"context_line":"        query \u003d self._filter_by_project_id_and_join(query, external_project_id)"},{"line_number":617,"context_line":""},{"line_number":618,"context_line":"        start \u003d offset"},{"line_number":619,"context_line":"        end \u003d offset + limit"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_bf401535","line":616,"updated":"2015-06-10 05:30:36.000000000","message":"So instead of calling this method, I\u0027m thinking we need something like this: http://pastebin.com/xZe1aSei\n...that pages across the blended new/old-structure entries. Note that if we don\u0027t do an order_by created date per comment above, we can do this blend process, otherwise we\u0027d really need to created-by sort across the new and old associations, which would be more difficult to do.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"cedddae46dd9aee3dbc4def46fb9b4ccc860d9cd","unresolved":false,"context_lines":[{"line_number":613,"context_line":"        if secret_type:"},{"line_number":614,"context_line":"            query \u003d query.filter(models.Secret.secret_type \u003d\u003d secret_type)"},{"line_number":615,"context_line":""},{"line_number":616,"context_line":"        query \u003d self._filter_by_project_id_and_join(query, external_project_id)"},{"line_number":617,"context_line":""},{"line_number":618,"context_line":"        start \u003d offset"},{"line_number":619,"context_line":"        end \u003d offset + limit"}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_a5311c5c","line":616,"in_reply_to":"3afb71cf_bf401535","updated":"2015-06-10 10:47:36.000000000","message":"I\u0027ll try it out.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"40f23fbb432f17909b93a0852f5c817bea5c2928","unresolved":false,"context_lines":[{"line_number":630,"context_line":"        return entities, offset, limit, total"},{"line_number":631,"context_line":""},{"line_number":632,"context_line":"    def _filter_by_project_id_and_join(self, query, project_id):"},{"line_number":633,"context_line":"        query_projects \u003d query.join(models.Project, models.Secret.project)"},{"line_number":634,"context_line":"        query_projects \u003d query_projects.filter("},{"line_number":635,"context_line":"            models.Project.external_id \u003d\u003d project_id)"},{"line_number":636,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_04d5a71a","line":633,"updated":"2015-06-10 05:30:36.000000000","message":"Could you replace these three lines with:\n\nquery_projects \u003d query.join(models.Secret.project_id \u003d\u003d project_id)\n\n?","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"cedddae46dd9aee3dbc4def46fb9b4ccc860d9cd","unresolved":false,"context_lines":[{"line_number":630,"context_line":"        return entities, offset, limit, total"},{"line_number":631,"context_line":""},{"line_number":632,"context_line":"    def _filter_by_project_id_and_join(self, query, project_id):"},{"line_number":633,"context_line":"        query_projects \u003d query.join(models.Project, models.Secret.project)"},{"line_number":634,"context_line":"        query_projects \u003d query_projects.filter("},{"line_number":635,"context_line":"            models.Project.external_id \u003d\u003d project_id)"},{"line_number":636,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_253e4c28","line":633,"in_reply_to":"3afb71cf_04d5a71a","updated":"2015-06-10 10:47:36.000000000","message":"sure.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"d2e0ebd3db8a950b9b03bd0b6cb3ef6f5055a744","unresolved":false,"context_lines":[{"line_number":634,"context_line":"        query_projects \u003d query_projects.filter("},{"line_number":635,"context_line":"            models.Project.external_id \u003d\u003d project_id)"},{"line_number":636,"context_line":""},{"line_number":637,"context_line":"        if query_projects.count() \u003e 0:"},{"line_number":638,"context_line":"            return query_projects"},{"line_number":639,"context_line":""},{"line_number":640,"context_line":"        query_old_project_assoc \u003d query.join(models.ProjectSecret,"}],"source_content_type":"text/x-python","patch_set":1,"id":"9af37de9_cf205e4c","line":637,"updated":"2015-05-11 15:27:23.000000000","message":"Yeah, I think technically we\u0027d need to pull from both query types (since we could have a mix of both old and new format secrets for a given project) but that\u0027s messy in a paged list query. It\u0027s probably better to migrate existing secrets to populate the direct project FK as part of the alembic process? So they\u0027d have both the direct and indirect FKs for a time. Then a future CR could have the app pay attention to the new relationship only, and another CR could remove the old relationship. It gets messy doing migrations :\\","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"40f23fbb432f17909b93a0852f5c817bea5c2928","unresolved":false,"context_lines":[{"line_number":655,"context_line":""},{"line_number":656,"context_line":"        # Note(john-wood-w): SQLAlchemy requires \u0027\u003d\u003d None\u0027 below,"},{"line_number":657,"context_line":"        #   not \u0027is None\u0027."},{"line_number":658,"context_line":"        # TODO(jfwood): Performance? Is the many-to-many join needed?"},{"line_number":659,"context_line":"        expiration_filter \u003d or_(models.Secret.expiration \u003d\u003d None,"},{"line_number":660,"context_line":"                                models.Secret.expiration \u003e utcnow)"},{"line_number":661,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3afb71cf_292abe90","line":658,"updated":"2015-06-10 05:30:36.000000000","message":"This TODO comment can be removed as the ProjectSecret assocs are the many-to-many join I\u0027m referring to.","commit_id":"705d31c7e68f6e33fd53b3050410f960cd228d90"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"aa428caa2332b1445e1af3016b9bab1a1c6e2a3d","unresolved":false,"context_lines":[{"line_number":651,"context_line":"                query_old_project_assoc.limit(limit).offset("},{"line_number":652,"context_line":"                    offset - project_count))"},{"line_number":653,"context_line":"            entities \u003d query_old_project_assoc.all()"},{"line_number":654,"context_line":"        elif offset \u003c project_count and end_offset \u003e\u003d project_count:"},{"line_number":655,"context_line":"            query_project \u003d query_projects.limit(limit).offset(offset)"},{"line_number":656,"context_line":"            entities \u003d query_project.all()"},{"line_number":657,"context_line":"            query_old_project_assoc \u003d query_old_project_assoc.limit("}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_710a3b23","line":654,"updated":"2015-06-16 14:02:34.000000000","message":"This can be else statement. If it gets here then the two statements must be true and can be ignored.","commit_id":"2b0f25301c7a27281fea49daf9c501b06797d5c5"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"c2d321c56ac7564cf0b0d0e5fcda3e138aa6fd22","unresolved":false,"context_lines":[{"line_number":651,"context_line":"                query_old_project_assoc.limit(limit).offset("},{"line_number":652,"context_line":"                    offset - project_count))"},{"line_number":653,"context_line":"            entities \u003d query_old_project_assoc.all()"},{"line_number":654,"context_line":"        elif offset \u003c project_count and end_offset \u003e\u003d project_count:"},{"line_number":655,"context_line":"            query_project \u003d query_projects.limit(limit).offset(offset)"},{"line_number":656,"context_line":"            entities \u003d query_project.all()"},{"line_number":657,"context_line":"            query_old_project_assoc \u003d query_old_project_assoc.limit("}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_82720bac","line":654,"in_reply_to":"fa32b979_710a3b23","updated":"2015-06-16 15:15:32.000000000","message":"That\u0027s true...I think I botched this logic in the code snippet actually.","commit_id":"2b0f25301c7a27281fea49daf9c501b06797d5c5"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"c2d321c56ac7564cf0b0d0e5fcda3e138aa6fd22","unresolved":false,"context_lines":[{"line_number":701,"context_line":"        :param session: existing db session reference."},{"line_number":702,"context_line":"        \"\"\""},{"line_number":703,"context_line":"        query \u003d session.query(models.Secret).filter_by(deleted\u003dFalse)"},{"line_number":704,"context_line":""},{"line_number":705,"context_line":"        query_projects \u003d query.filter(models.Project.external_id \u003d\u003d project_id)"},{"line_number":706,"context_line":""},{"line_number":707,"context_line":"        if query_projects.count() \u003e 0:"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_446f30c5","line":704,"updated":"2015-06-16 15:15:32.000000000","message":"I think this needs to be reworked to deal with a mix of old and new project secrets. So something like this I think:\n\n        query \u003d session.query(models.Secret).filter_by(deleted\u003dFalse)\n\n        query_projects, query_old_project_assoc \u003d (\n            self._build_filter_secrets_by_project_queries(\n                query, external_project_id))\n\n        query \u003d session.query(query_projects).join(query_old_project_assoc)\n\n        return query","commit_id":"2b0f25301c7a27281fea49daf9c501b06797d5c5"}]}
