From ef80ecd3b6a015173f5241b715965a5cfc69362e Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 25 Jan 2018 10:19:35 -0500 Subject: [PATCH] only import the redbaron library on-demand redbaron is a library we use to facilitate parsing local settings files; at _import_ time it generates a parse tree and caches it to disk at `/tmp`; this process is _really time consuming, and only necessary if we're actually *using* the library right now, we're importing this library and paying the penalty _every_ time we load the awx application --- awx/conf/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/awx/conf/utils.py b/awx/conf/utils.py index b0d4ffb694..7c8dce569d 100755 --- a/awx/conf/utils.py +++ b/awx/conf/utils.py @@ -6,9 +6,6 @@ import glob import os import shutil -# RedBaron -from redbaron import RedBaron, indent - # AWX from awx.conf.registry import settings_registry @@ -33,6 +30,8 @@ def comment_assignments(patterns, assignment_names, dry_run=True, backup_suffix= def comment_assignments_in_file(filename, assignment_names, dry_run=True, backup_filename=None): + from redbaron import RedBaron, indent + if isinstance(assignment_names, basestring): assignment_names = [assignment_names] else: