diff options
| author | John Estabrook <jestabro@vyos.io> | 2020-02-14 10:41:13 -0600 | 
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2020-02-14 11:42:45 -0600 | 
| commit | 3735e8f6296d61a7e7927620a0fbfc73e88743f5 (patch) | |
| tree | 50d14a1a58b3f346b63d0f0426d40d3dc0009e52 /src | |
| parent | e67f0d98f488c3b0635ae6be120133d56ea24ea1 (diff) | |
| download | vyos-1x-3735e8f6296d61a7e7927620a0fbfc73e88743f5.tar.gz vyos-1x-3735e8f6296d61a7e7927620a0fbfc73e88743f5.zip  | |
http api: T2040: reload Config in route definition
Diffstat (limited to 'src')
| -rwxr-xr-x | src/services/vyos-http-api-server | 11 | 
1 files changed, 4 insertions, 7 deletions
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']  | 
