From a420d5962d4ed30700155f54df915f9545a09ee6 Mon Sep 17 00:00:00 2001 From: Felipe Monteiro Date: Thu, 15 Feb 2018 22:04:38 -0500 Subject: [PATCH] [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 --- deckhand/service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deckhand/service.py b/deckhand/service.py index 1dc00b5b..5c8dca38 100644 --- a/deckhand/service.py +++ b/deckhand/service.py @@ -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')