Esempio n. 1
0
    def put(self):
        """ Loads tarball config into the config provider """
        # Generate a new empty dir to load the config into
        config_provider.new_config_dir()
        input_stream = request.stream
        with tarfile.open(mode="r|gz", fileobj=input_stream) as tar_stream:
            tar_stream.extractall(config_provider.get_config_dir_path())

        config_provider.create_copy_of_config_dir()

        # now try to connect to the db provided in their config to validate it works
        combined = dict(**app.config)
        combined.update(config_provider.get_config())
        configure(combined)

        return make_response('OK')
Esempio n. 2
0
    def post(self):
        # Get a clean transient directory to write the config into
        config_provider.new_config_dir()

        kube_accessor = KubernetesAccessorSingleton.get_instance()
        kube_accessor.save_secret_to_directory(config_provider.get_config_dir_path())
        config_provider.create_copy_of_config_dir()

        # We update the db configuration to connect to their specified one
        # (Note, even if this DB isn't valid, it won't affect much in the config app, since we'll report an error,
        # and all of the options create a new clean dir, so we'll never pollute configs)
        combined = dict(**app.config)
        combined.update(config_provider.get_config())
        configure(combined)

        return 200
Esempio n. 3
0
 def post(self):
     config_provider.new_config_dir()
     return make_response('OK')