Fix Docker Auth and our V2 registry paths to support library (i.e. namespace-less) repositories.

This support is placed behind a feature flag.
This commit is contained in:
Joseph Schorr 2016-01-21 15:40:51 -05:00
parent 06b0f756bd
commit e4ffaff869
37 changed files with 270 additions and 148 deletions

View file

@ -23,6 +23,7 @@ from functools import wraps
from config import frontend_visible_config
from external_libraries import get_external_javascript, get_external_css
from util.secscan.api import PRIORITY_LEVELS
from util.names import parse_namespace_repository
import features
@ -47,11 +48,24 @@ def get_cache_busters():
return CACHE_BUSTERS
class RepoPathConverter(BaseConverter):
regex = '[\.a-zA-Z0-9_\-]+/[\.a-zA-Z0-9_\-]+'
weight = 200
def parse_repository_name(f):
@wraps(f)
def wrapper(repository, *args, **kwargs):
lib_namespace = app.config['LIBRARY_NAMESPACE']
(namespace, repository) = parse_namespace_repository(repository, lib_namespace)
return f(namespace, repository, *args, **kwargs)
return wrapper
def parse_repository_name_and_tag(f):
@wraps(f)
def wrapper(repository, *args, **kwargs):
lib_namespace = app.config['LIBRARY_NAMESPACE']
namespace, repository, tag = parse_namespace_repository(repository, lib_namespace,
include_tag=True)
return f(namespace, repository, tag, *args, **kwargs)
return wrapper
app.url_map.converters['repopath'] = RepoPathConverter
def route_show_if(value):
def decorator(f):