This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/config_app/config_endpoints/api/tar_config_loader.py

26 lines
919 B
Python
Raw Normal View History

import logging
from flask import request, make_response
from config_app.c_app import config_provider
from config_app.config_endpoints.api import resource, ApiResource, nickname, validate_json_request
logger = logging.getLogger(__name__)
@resource('/v1/configapp/tarconfig')
class TarConfigLoader(ApiResource):
""" Resource for validating a block of configuration against an external service. """
@nickname('uploadTarballConfig')
def post(self):
""" Loads tarball config into the config provider """
input_stream = request.stream
# since we're working with a tar file, shouldn't be larger than ~20KB, so just read the whole thing into mem
buf = input_stream.read(-1)
# TODO(sam): refactor config provider to accept a stream write to avoid loading into memory
config_provider.write_volume_file('test_tar.tar.gz', buf)
return make_response('OK')