Remove license code in Quay
No longer needed under Red Hat rules \o/ Fixes https://jira.coreos.com/browse/QUAY-883
This commit is contained in:
parent
041a7fcd36
commit
3586955669
23 changed files with 19 additions and 1471 deletions
|
@ -13,7 +13,7 @@ from flask import request, make_response, jsonify
|
|||
|
||||
import features
|
||||
|
||||
from app import app, avatar, superusers, authentication, config_provider, license_validator
|
||||
from app import app, avatar, superusers, authentication, config_provider
|
||||
from auth import scopes
|
||||
from auth.auth_context import get_authenticated_user
|
||||
from auth.permissions import SuperUserPermission
|
||||
|
@ -28,7 +28,6 @@ from endpoints.api.superuser_models_pre_oci import (pre_oci_model, ServiceKeyDoe
|
|||
ServiceKeyAlreadyApproved,
|
||||
InvalidRepositoryBuildException)
|
||||
from util.useremails import send_confirmation_email, send_recovery_email
|
||||
from util.license import decode_license, LicenseDecodeError
|
||||
from util.security.ssl import load_certificate, CertInvalidException
|
||||
from util.config.validator import EXTRA_CA_DIRECTORY
|
||||
from _init import ROOT_DIR
|
||||
|
@ -968,77 +967,6 @@ class SuperUserCustomCertificate(ApiResource):
|
|||
raise Unauthorized()
|
||||
|
||||
|
||||
@resource('/v1/superuser/license')
|
||||
@internal_only
|
||||
@show_if(features.SUPER_USERS)
|
||||
class SuperUserLicense(ApiResource):
|
||||
""" Resource for getting and setting a license. """
|
||||
schemas = {
|
||||
'UpdateLicense': {
|
||||
'type': 'object',
|
||||
'description': 'Updates a license',
|
||||
'required': [
|
||||
'license',
|
||||
],
|
||||
'properties': {
|
||||
'license': {
|
||||
'type': 'string'
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@nickname('getLicense')
|
||||
@require_fresh_login
|
||||
@require_scope(scopes.SUPERUSER)
|
||||
@verify_not_prod
|
||||
def get(self):
|
||||
""" Returns the current decoded license. """
|
||||
if SuperUserPermission().can():
|
||||
try:
|
||||
decoded_license = config_provider.get_license()
|
||||
except LicenseDecodeError as le:
|
||||
raise InvalidRequest(le.message)
|
||||
|
||||
statuses = decoded_license.validate(app.config)
|
||||
all_met = all(status.is_met() for status in statuses)
|
||||
|
||||
return {
|
||||
'status': [status.as_dict(for_private=True) for status in statuses],
|
||||
'success': all_met,
|
||||
}
|
||||
|
||||
raise Unauthorized()
|
||||
|
||||
@nickname('updateLicense')
|
||||
@require_fresh_login
|
||||
@require_scope(scopes.SUPERUSER)
|
||||
@verify_not_prod
|
||||
@validate_json_request('UpdateLicense')
|
||||
def put(self):
|
||||
""" Validates the given license contents and then saves it to the config volume. """
|
||||
if SuperUserPermission().can():
|
||||
license_contents = request.get_json()['license']
|
||||
try:
|
||||
decoded_license = decode_license(license_contents)
|
||||
except LicenseDecodeError as le:
|
||||
raise InvalidRequest(le.message)
|
||||
|
||||
statuses = decoded_license.validate(app.config)
|
||||
all_met = all(status.is_met() for status in statuses)
|
||||
if all_met:
|
||||
# Save the license and update the license check thread.
|
||||
config_provider.save_license(license_contents)
|
||||
license_validator.compute_license_sufficiency()
|
||||
|
||||
return {
|
||||
'status': [status.as_dict(for_private=True) for status in statuses],
|
||||
'success': all_met,
|
||||
}
|
||||
|
||||
raise Unauthorized()
|
||||
|
||||
|
||||
@resource('/v1/superuser/<build_uuid>/logs')
|
||||
@path_param('build_uuid', 'The UUID of the build')
|
||||
@show_if(features.SUPER_USERS)
|
||||
|
|
Reference in a new issue