mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 10:57:36 -02:30
some more minor callback cleanup and development tweaks
This commit is contained in:
@@ -171,7 +171,6 @@ class EncryptedCacheProxy(object):
|
|||||||
def get(self, key, **kwargs):
|
def get(self, key, **kwargs):
|
||||||
value = self.cache.get(key, **kwargs)
|
value = self.cache.get(key, **kwargs)
|
||||||
value = self._handle_encryption(self.decrypter, key, value)
|
value = self._handle_encryption(self.decrypter, key, value)
|
||||||
logger.debug('cache get(%r, %r) -> %r', key, empty, filter_sensitive(self.registry, key, value))
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def set(self, key, value, log=True, **kwargs):
|
def set(self, key, value, log=True, **kwargs):
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ class BaseWorker(object):
|
|||||||
finally:
|
finally:
|
||||||
if 'uuid' in body:
|
if 'uuid' in body:
|
||||||
uuid = body['uuid']
|
uuid = body['uuid']
|
||||||
logger.debug('task {} is finished'.format(uuid))
|
|
||||||
finished.put(uuid)
|
finished.put(uuid)
|
||||||
logger.warn('worker exiting gracefully pid:{}'.format(os.getpid()))
|
logger.warn('worker exiting gracefully pid:{}'.format(os.getpid()))
|
||||||
|
|
||||||
|
|||||||
@@ -139,37 +139,6 @@ class LogstashFormatter(LogstashFormatterBase):
|
|||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
data_for_log = {}
|
data_for_log = {}
|
||||||
|
|
||||||
def index_by_name(alist):
|
|
||||||
"""Takes a list of dictionaries with `name` as a key in each dict
|
|
||||||
and returns a dictionary indexed by those names"""
|
|
||||||
adict = {}
|
|
||||||
for item in alist:
|
|
||||||
subdict = copy(item)
|
|
||||||
if 'name' in subdict:
|
|
||||||
name = subdict.get('name', None)
|
|
||||||
elif 'path' in subdict:
|
|
||||||
name = subdict.get('path', None)
|
|
||||||
if name:
|
|
||||||
# Logstash v2 can not accept '.' in a name
|
|
||||||
name = name.replace('.', '_')
|
|
||||||
adict[name] = subdict
|
|
||||||
return adict
|
|
||||||
|
|
||||||
def convert_to_type(t, val):
|
|
||||||
if t is float:
|
|
||||||
val = val[:-1] if val.endswith('s') else val
|
|
||||||
try:
|
|
||||||
return float(val)
|
|
||||||
except ValueError:
|
|
||||||
return val
|
|
||||||
elif t is int:
|
|
||||||
try:
|
|
||||||
return int(val)
|
|
||||||
except ValueError:
|
|
||||||
return val
|
|
||||||
elif t is str:
|
|
||||||
return val
|
|
||||||
|
|
||||||
if kind == 'job_events':
|
if kind == 'job_events':
|
||||||
job_event = raw_data['python_objects']['job_event']
|
job_event = raw_data['python_objects']['job_event']
|
||||||
for field_object in job_event._meta.fields:
|
for field_object in job_event._meta.fields:
|
||||||
@@ -209,6 +178,21 @@ class LogstashFormatter(LogstashFormatterBase):
|
|||||||
data_for_log['host_name'] = raw_data['host_name']
|
data_for_log['host_name'] = raw_data['host_name']
|
||||||
data_for_log['job_id'] = raw_data['job_id']
|
data_for_log['job_id'] = raw_data['job_id']
|
||||||
elif kind == 'performance':
|
elif kind == 'performance':
|
||||||
|
def convert_to_type(t, val):
|
||||||
|
if t is float:
|
||||||
|
val = val[:-1] if val.endswith('s') else val
|
||||||
|
try:
|
||||||
|
return float(val)
|
||||||
|
except ValueError:
|
||||||
|
return val
|
||||||
|
elif t is int:
|
||||||
|
try:
|
||||||
|
return int(val)
|
||||||
|
except ValueError:
|
||||||
|
return val
|
||||||
|
elif t is str:
|
||||||
|
return val
|
||||||
|
|
||||||
request = raw_data['python_objects']['request']
|
request = raw_data['python_objects']['request']
|
||||||
response = raw_data['python_objects']['response']
|
response = raw_data['python_objects']['response']
|
||||||
|
|
||||||
|
|||||||
@@ -179,3 +179,4 @@ else:
|
|||||||
os.environ['SDB_NOTIFY_HOST'] = os.popen('ip route').read().split(' ')[2]
|
os.environ['SDB_NOTIFY_HOST'] = os.popen('ip route').read().split(' ')[2]
|
||||||
|
|
||||||
WEBSOCKET_ORIGIN_WHITELIST = ['https://localhost:8043', 'https://localhost:3000']
|
WEBSOCKET_ORIGIN_WHITELIST = ['https://localhost:8043', 'https://localhost:3000']
|
||||||
|
AWX_CALLBACK_PROFILE = True
|
||||||
|
|||||||
Reference in New Issue
Block a user