Fix show_if ordering and add a check that fails if misordered

Before this change, these endpoints still existed even if the flag was off
This commit is contained in:
Joseph Schorr 2017-05-01 13:14:20 -04:00
parent 8552f7f6e6
commit 3e8bc07b6c
4 changed files with 16 additions and 4 deletions

View file

@ -58,8 +58,8 @@ def _security_status_for_image(namespace, repository, repo_image, include_vulner
}
@show_if(features.SECURITY_SCANNER)
@resource('/v1/repository/<apirepopath:repository>/image/<imageid>/security')
@show_if(features.SECURITY_SCANNER)
@path_param('repository', 'The full path of the repository. e.g. namespace/name')
@path_param('imageid', 'The image ID')
class RepositoryImageSecurity(RepositoryParamResource):
@ -80,8 +80,8 @@ class RepositoryImageSecurity(RepositoryParamResource):
return _security_status_for_image(namespace, repository, repo_image,
parsed_args.vulnerabilities)
@show_if(features.SECURITY_SCANNER)
@resource(MANIFEST_DIGEST_ROUTE + '/security')
@show_if(features.SECURITY_SCANNER)
@path_param('repository', 'The full path of the repository. e.g. namespace/name')
@path_param('manifestref', 'The digest of the manifest')
class RepositoryManifestSecurity(RepositoryParamResource):