Merge pull request #5527 from chrismeyersfsu/fix-log_settings

prevent traceback when host is set to null/None
This commit is contained in:
Chris Meyers 2017-02-23 15:52:32 -05:00 committed by GitHub
commit 4e65e6624a
2 changed files with 12 additions and 3 deletions

View File

@ -2,9 +2,11 @@
import json
import logging
import os
import uuid
# Django
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
# Tower
from awx.conf import fields, register
@ -314,13 +316,20 @@ register(
category=_('Logging'),
category_slug='logging',
)
def init_LOG_AGGREGATOR_TOWER_UUID():
unique_id = uuid.uuid4()
settings.LOG_AGGREGATOR_TOWER_UUID = unique_id
return unique_id
register(
'LOG_AGGREGATOR_TOWER_UUID',
field_class=fields.CharField,
allow_blank=True,
label=_('Cluster-wide Tower unique identifier.'),
help_text=_('Useful to uniquely identify Tower instances.'),
category=_('Logging'),
category_slug='logging',
default=None,
default=init_LOG_AGGREGATOR_TOWER_UUID,
)

View File

@ -88,7 +88,7 @@ class BaseHTTPSHandler(logging.Handler):
self.session.headers.update(headers)
def get_http_host(self):
host = self.host
host = self.host or ''
if not host.startswith('http'):
host = 'http://%s' % self.host
if self.port != 80 and self.port is not None: