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
This commit is contained in:
Ryan Petrello 2018-01-25 10:19:35 -05:00
parent 50290a9063
commit ef80ecd3b6
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -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: