[Trivial Fix] Make profile directory if it doesn't exist

The current code assumes /tmp/profiles already exists. This
creates it if it already doesn't to avoid OSError getting raised.

Change-Id: Ib317f971e5345c5a40cfdad2a5956186a6dea252
This commit is contained in:
Felipe Monteiro 2018-02-15 22:04:38 -05:00
parent 9f2a0fb347
commit a420d5962d
1 changed files with 5 additions and 1 deletions

View File

@ -86,8 +86,12 @@ def deckhand_app_factory(global_config, **local_config):
if CONF.profiler:
LOG.warning("Profiler ENABLED. Expect significant "
"performance overhead.")
profile_dir = "/tmp/profiles" # nosec w/o profile data
if not os.path.isdir(profile_dir):
os.mkdir(profile_dir)
LOG.debug("Profiler artifacts will be saved to %s.", profile_dir)
return ProfilerMiddleware(
configure_app(app, version='v1.0'),
profile_dir="/tmp/profiles") # nosec w/o profile data
profile_dir=profile_dir)
else:
return configure_app(app, version='v1.0')