Temporarily put user rename behind a feature flag. Switch queue names back to using the username for namespace while we figure out a real migration strategy.

This commit is contained in:
Jake Moshenko 2014-11-20 15:36:39 -05:00
parent 768a60b414
commit 2b8c246476
9 changed files with 44 additions and 67 deletions

View file

@ -144,7 +144,7 @@ class TestRepositoryNotification(RepositoryParamResource):
event_info = NotificationEvent.get_event(notification.event.name)
sample_data = event_info.get_sample_data(repository=notification.repository)
notification_data = build_notification_data(notification, sample_data)
notification_queue.put([str(notification.repository.namespace_user.id), repository,
notification_queue.put([notification.repository.namespace_user.username, repository,
notification.event.name], json.dumps(notification_data))
return {}

View file

@ -198,7 +198,8 @@ class User(ApiResource):
else:
model.update_email(user, new_email, auto_verify=not features.MAILING)
if 'username' in user_data and user_data['username'] != user.username:
if ('username' in user_data and user_data['username'] != user.username and
features.USER_RENAME):
new_username = user_data['username']
if model.get_user_or_org(new_username) is not None:
# Username already used

View file

@ -238,7 +238,7 @@ def start_build(repository, dockerfile_id, tags, build_name, subdir, manual,
dockerfile_id, build_name,
trigger, pull_robot_name=pull_robot_name)
dockerfile_build_queue.put([str(repository.namespace_user.id), repository.name], json.dumps({
dockerfile_build_queue.put([repository.namespace_user.username, repository.name], json.dumps({
'build_uuid': build_request.uuid,
'pull_credentials': model.get_pull_credentials(pull_robot_name) if pull_robot_name else None
}), retries_remaining=1)

View file

@ -58,5 +58,5 @@ def spawn_notification(repo, event_name, extra_data={}, subpage=None, pathargs=[
event_name=event_name)
for notification in list(notifications):
notification_data = build_notification_data(notification, event_data, performer_data)
path = [str(repo.namespace_user.id), repo.name, event_name] + pathargs
path = [repo.namespace_user.username, repo.name, event_name] + pathargs
notification_queue.put(path, json.dumps(notification_data))

View file

@ -259,7 +259,7 @@ def put_image_layer(namespace, repository, image_id):
# process it.
profile.debug('Adding layer to diff queue')
repo = model.get_repository(namespace, repository)
image_diff_queue.put([str(repo.namespace_user.id), repository, image_id], json.dumps({
image_diff_queue.put([repo.namespace_user.username, repository, image_id], json.dumps({
'namespace_user_id': repo.namespace_user.id,
'repository': repository,
'image_id': image_id,
@ -333,7 +333,7 @@ def put_image_checksum(namespace, repository, image_id):
# process it.
profile.debug('Adding layer to diff queue')
repo = model.get_repository(namespace, repository)
image_diff_queue.put([str(repo.namespace_user.id), repository, image_id], json.dumps({
image_diff_queue.put([repo.namespace_user.username, repository, image_id], json.dumps({
'namespace_user_id': repo.namespace_user.id,
'repository': repository,
'image_id': image_id,