From 3735e8f6296d61a7e7927620a0fbfc73e88743f5 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Fri, 14 Feb 2020 10:41:13 -0600 Subject: http api: T2040: reload Config in route definition --- src/services/vyos-http-api-server | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/services/vyos-http-api-server') diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server index 1abaed873..da6e5b118 100755 --- a/src/services/vyos-http-api-server +++ b/src/services/vyos-http-api-server @@ -78,7 +78,8 @@ def auth_required(f): @auth_required def configure(): session = app.config['vyos_session'] - config = app.config['vyos_config'] + env = session.get_session_env() + config = vyos.config.Config(session_env=env) strict_field = bottle.request.forms.get("strict") if strict_field == "true": @@ -187,8 +188,9 @@ def configure(): @app.route('/retrieve', method='POST') @auth_required def get_value(): - config = app.config['vyos_config'] session = app.config['vyos_session'] + env = session.get_session_env() + config = vyos.config.Config(session_env=env) command = bottle.request.forms.get("data") command = json.loads(command) @@ -235,7 +237,6 @@ def get_value(): @app.route('/config-file', method='POST') @auth_required def config_file_op(): - config = app.config['vyos_config'] session = app.config['vyos_session'] command = bottle.request.forms.get("data") @@ -273,7 +274,6 @@ def config_file_op(): @app.route('/image', method='POST') @auth_required def config_file_op(): - config = app.config['vyos_config'] session = app.config['vyos_session'] command = bottle.request.forms.get("data") @@ -324,11 +324,8 @@ if __name__ == '__main__': print("Failed to load the HTTP API server config: {0}".format(e)) session = ConfigSession(os.getpid()) - env = session.get_session_env() - config = vyos.config.Config(session_env=env) app.config['vyos_session'] = session - app.config['vyos_config'] = config app.config['vyos_keys'] = server_config['api_keys'] app.config['vyos_debug'] = server_config['debug'] -- cgit v1.2.3