Ignore 404's when generating static report with frozen-flask

With the API, there are now multiple situations where it is possible
that a 404 is returned, for example during generation of an
incomplete playbook report.
A 404 is therefore not fatal and should not interrupt the generation.

Change-Id: I4e28fb4f8055027b98201023d218ffe3c3a1e39d
(cherry picked from commit 3b5db8b931)
This commit is contained in:
David Moreau-Simard 2017-08-12 11:45:34 -04:00 committed by David Moreau Simard
parent 2744516ca4
commit 490fbf3423
2 changed files with 3 additions and 0 deletions

View File

@ -26,6 +26,7 @@ from ara import utils
from cliff.command import Command
from flask_frozen import Freezer, walk_directory
from flask_frozen import MissingURLGeneratorWarning
from flask_frozen import NotFoundWarning
from junit_xml import TestCase
from junit_xml import TestSuite
from oslo_utils import encodeutils
@ -63,6 +64,7 @@ class GenerateHtml(Command):
self.app.ara.config['ARA_PLAYBOOK_OVERRIDE'] = args.playbook
self.log.warn('Generating static files at %s...', args.path)
filterwarnings('ignore', '.*', NotFoundWarning)
if self.app.ara.config['ARA_IGNORE_EMPTY_GENERATION']:
filterwarnings('ignore', '.*', MissingURLGeneratorWarning)
freezer = Freezer(self.app.ara)

View File

@ -132,6 +132,7 @@ FREEZER_IGNORE_MIMETYPE_WARNINGS = _ara_config(config,
'ARA_IGNORE_MIMETYPE_WARNINGS',
value_type='boolean')
FREEZER_RELATIVE_URLS = True
FREEZER_IGNORE_404_NOT_FOUND = True
# SQLAlchemy/Alembic settings
SQLALCHEMY_DATABASE_URI = _ara_config(config, 'database', 'ARA_DATABASE')