From 7ae19a8ba33db59035f8f693d39239319146c80b Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Tue, 23 Feb 2021 14:50:27 -0500 Subject: [PATCH] Fix tests --- awx/settings/defaults.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 9471899b37..aaab3a3571 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -1,6 +1,7 @@ # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. +import base64 import os import re # noqa import sys @@ -148,7 +149,10 @@ SCHEDULE_MAX_JOBS = 10 SITE_ID = 1 # Make this unique, and don't share it with anybody. -SECRET_KEY = open('/etc/tower/SECRET_KEY', 'rb').read().strip() +if os.path.exists('/etc/tower/SECRET_KEY'): + SECRET_KEY = open('/etc/tower/SECRET_KEY', 'rb').read().strip() +else: + SECRET_KEY = base64.encodebytes(os.urandom(32)).decode().rstrip() # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts