Merge remote-tracking branch 'origin/allyourbaseimage'
Conflicts: test/data/test.db test/test_api_usage.py
This commit is contained in:
commit
f4642be11a
126 changed files with 647 additions and 207332 deletions
|
@ -25,7 +25,7 @@ from auth.permissions import (ReadRepositoryPermission,
|
|||
AdministerOrganizationPermission,
|
||||
OrganizationMemberPermission,
|
||||
ViewTeamPermission)
|
||||
from endpoints.common import common_login
|
||||
from endpoints.common import common_login, truthy_param
|
||||
from util.cache import cache_control
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
@ -390,7 +390,7 @@ def get_matching_entities(prefix):
|
|||
if permission.can():
|
||||
robot_namespace = namespace_name
|
||||
|
||||
if request.args.get('includeTeams', False):
|
||||
if truthy_param(request.args.get('includeTeams', False)):
|
||||
teams = model.get_matching_teams(prefix, organization)
|
||||
|
||||
except model.InvalidOrganizationException:
|
||||
|
@ -984,20 +984,16 @@ def list_repos():
|
|||
page = request.args.get('page', None)
|
||||
limit = request.args.get('limit', None)
|
||||
namespace_filter = request.args.get('namespace', None)
|
||||
include_public = request.args.get('public', 'true')
|
||||
include_private = request.args.get('private', 'true')
|
||||
sort = request.args.get('sort', 'false')
|
||||
include_count = request.args.get('count', 'false')
|
||||
include_public = truthy_param(request.args.get('public', True))
|
||||
include_private = truthy_param(request.args.get('private', True))
|
||||
sort = truthy_param(request.args.get('sort', False))
|
||||
include_count = truthy_param(request.args.get('count', False))
|
||||
|
||||
try:
|
||||
limit = int(limit) if limit else None
|
||||
except TypeError:
|
||||
limit = None
|
||||
|
||||
include_public = include_public == 'true'
|
||||
include_private = include_private == 'true'
|
||||
include_count = include_count == 'true'
|
||||
sort = sort == 'true'
|
||||
if page:
|
||||
try:
|
||||
page = int(page)
|
||||
|
@ -1012,7 +1008,6 @@ def list_repos():
|
|||
if include_count:
|
||||
repo_count = model.get_visible_repository_count(username,
|
||||
include_public=include_public,
|
||||
sort=sort,
|
||||
namespace=namespace_filter)
|
||||
|
||||
repo_query = model.get_visible_repositories(username, limit=limit, page=page,
|
||||
|
@ -1089,14 +1084,19 @@ def delete_repository(namespace, repository):
|
|||
|
||||
|
||||
def image_view(image):
|
||||
extended_props = image
|
||||
if image.storage and image.storage.id:
|
||||
extended_props = image.storage
|
||||
|
||||
command = extended_props.command
|
||||
return {
|
||||
'id': image.docker_image_id,
|
||||
'created': image.created,
|
||||
'comment': image.comment,
|
||||
'command': json.loads(image.command) if image.command else None,
|
||||
'created': extended_props.created,
|
||||
'comment': extended_props.comment,
|
||||
'command': json.loads(command) if command else None,
|
||||
'ancestors': image.ancestors,
|
||||
'dbid': image.id,
|
||||
'size': image.image_size,
|
||||
'size': extended_props.image_size,
|
||||
}
|
||||
|
||||
|
||||
|
@ -1432,7 +1432,14 @@ def get_image(namespace, repository, image_id):
|
|||
def get_image_changes(namespace, repository, image_id):
|
||||
permission = ReadRepositoryPermission(namespace, repository)
|
||||
if permission.can() or model.repository_is_public(namespace, repository):
|
||||
diffs_path = store.image_file_diffs_path(namespace, repository, image_id)
|
||||
image = model.get_repo_image(namespace, repository, image_id)
|
||||
|
||||
if not image:
|
||||
abort(404)
|
||||
|
||||
uuid = image.storage and image.storage.uuid
|
||||
diffs_path = store.image_file_diffs_path(namespace, repository, image_id,
|
||||
uuid)
|
||||
|
||||
try:
|
||||
response_json = store.get_content(diffs_path)
|
||||
|
@ -1449,7 +1456,8 @@ def get_image_changes(namespace, repository, image_id):
|
|||
def delete_full_tag(namespace, repository, tag):
|
||||
permission = AdministerRepositoryPermission(namespace, repository)
|
||||
if permission.can():
|
||||
model.delete_tag_and_images(namespace, repository, tag)
|
||||
model.delete_tag(namespace, repository, tag)
|
||||
model.garbage_collect_repository(namespace, repository)
|
||||
|
||||
username = current_user.db_user().username
|
||||
log_action('delete_tag', namespace,
|
||||
|
|
Reference in a new issue