From 4f1c1b088b8199f959d6f0606a7d77b0c89aa96a Mon Sep 17 00:00:00 2001 From: giancarlo Date: Tue, 10 Apr 2018 17:47:06 +0200 Subject: [PATCH 1/3] #61: Fix getting 404 (removing SERVER_NAME from flask app), casting the PORT to INT in the wsgi.py --- bin/wsgi.py | 2 +- prom2teams/app/api.py | 2 +- prom2teams/app/configuration.py | 5 ----- prom2teams/config/settings.py | 1 - 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/bin/wsgi.py b/bin/wsgi.py index cdc0f22..47eacfd 100644 --- a/bin/wsgi.py +++ b/bin/wsgi.py @@ -11,5 +11,5 @@ if __name__ == "__main__": host = application.config['HOST'] - port = application.config['PORT'] + port = int(application.config['PORT']) application.run(host=host, port=port) diff --git a/prom2teams/app/api.py b/prom2teams/app/api.py index e88c205..0cf93f6 100644 --- a/prom2teams/app/api.py +++ b/prom2teams/app/api.py @@ -30,4 +30,4 @@ def init_app(application): init_app(app) -log.info(app.config['APP_NAME'] + ' started on ' + app.config['SERVER_NAME']) +log.info('{} started on {}:{}'.format(app.config['APP_NAME'], app.config['HOST'], app.config['PORT'])) diff --git a/prom2teams/app/configuration.py b/prom2teams/app/configuration.py index 53f0eb9..b374ff0 100644 --- a/prom2teams/app/configuration.py +++ b/prom2teams/app/configuration.py @@ -34,17 +34,12 @@ def _update_application_configuration(application, configuration): if 'Log' in configuration and 'Path' in configuration['Log']: application.config['LOG_FILE_PATH'] = configuration['Log']['Path'] if 'HTTP Server' in configuration: - _host, _port = application.config['SERVER_NAME'].split(':', 1) if 'Host' in configuration['HTTP Server']: _host = configuration['HTTP Server']['Host'] application.config['HOST'] = _host if 'Port' in configuration['HTTP Server']: _port = configuration['HTTP Server']['Port'] application.config['PORT'] = _port - if 'Name' in configuration['HTTP Server']: - application.config['SERVER_NAME'] = configuration['HTTP Server']['Name'] - else: - application.config['SERVER_NAME'] = _host + ':' + _port def _config_provided(filepath): diff --git a/prom2teams/config/settings.py b/prom2teams/config/settings.py index 7230226..52f04d9 100644 --- a/prom2teams/config/settings.py +++ b/prom2teams/config/settings.py @@ -3,7 +3,6 @@ PORT = 8089 # Flask settings DEBUG = False -SERVER_NAME = 'localhost:8089' # Flask-Restplus settings SWAGGER_UI_DOC_EXPANSION = 'list' From 3bc52edb4b9516d1b383d7ba5589e3379659b21d Mon Sep 17 00:00:00 2001 From: giancarlo Date: Tue, 10 Apr 2018 18:15:06 +0200 Subject: [PATCH 2/3] CHANGELOG modified --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1d94da..419d34c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## [Unreleased](https://github.com/idealista/prom2teams/tree/develop) +- *[#61](https://github.com/idealista/prom2teams/pull/63) Fix getting 404 errors - SERVER_NAME removed from flask app* @Gkrlo + ## [2.0.2](https://github.com/idealista/prom2teams/tree/2.0.2) [Full Changelog](https://github.com/idealista/prom2teams/compare/2.0.1...2.0.2) From 19930696302e9ab1242ad2ef894a7bec8c273d6c Mon Sep 17 00:00:00 2001 From: giancarlo Date: Wed, 11 Apr 2018 12:25:05 +0200 Subject: [PATCH 3/3] v2.0.3 to master --- CHANGELOG.md | 6 +++++- setup.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 419d34c..13d517a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,13 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog). ## [Unreleased](https://github.com/idealista/prom2teams/tree/develop) -- *[#61](https://github.com/idealista/prom2teams/pull/63) Fix getting 404 errors - SERVER_NAME removed from flask app* @Gkrlo +## [2.0.3](https://github.com/idealista/prom2teams/tree/2.0.3) +[Full Changelog](https://github.com/idealista/prom2teams/compare/2.0.2...2.0.3) +### Fixed +- *[#61](https://github.com/idealista/prom2teams/pull/63) Fix getting 404 errors - SERVER_NAME removed from flask app* @Gkrlo + ## [2.0.2](https://github.com/idealista/prom2teams/tree/2.0.2) [Full Changelog](https://github.com/idealista/prom2teams/compare/2.0.1...2.0.2) ### Fixed diff --git a/setup.py b/setup.py index 7ca042a..1fa7777 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def read_requirements_file(): setup(name='prom2teams', - version='2.0.2', + version='2.0.3', description='Project that redirects Prometheus Alert Manager ' 'notifications to Microsoft Teams', long_description=readme,