mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 22:16:00 -03:30
correct filter events on the migration event horizon
events that existed *prior* to the partition migration will have `job_created=1970-01-01` auto-applied at migration time; as such, queries for these events e.g., /api/v2/job/N/job_events/ use 1970-01-01 in related event searche events created *after* the partition migration (net-new playbook runs will have `job_created` values that *exactly match* the related `UnifiedJob.created` field.
This commit is contained in:
@@ -90,7 +90,7 @@ __all__ = [
|
||||
'create_temporary_fifo',
|
||||
'truncate_stdout',
|
||||
'deepmerge',
|
||||
'cleanup_new_process',
|
||||
'get_event_partition_epoch',
|
||||
]
|
||||
|
||||
|
||||
@@ -208,6 +208,28 @@ def memoize_delete(function_name):
|
||||
return cache.delete(function_name)
|
||||
|
||||
|
||||
@memoize(ttl=3600 * 24) # in practice, we only need this to load once at process startup time
|
||||
def get_event_partition_epoch():
|
||||
from django.db.migrations.recorder import MigrationRecorder
|
||||
return MigrationRecorder.Migration.objects.filter(
|
||||
app='main', name='0124_event_partitions'
|
||||
).first().applied
|
||||
|
||||
|
||||
@memoize()
|
||||
def get_ansible_version():
|
||||
"""
|
||||
Return Ansible version installed.
|
||||
Ansible path needs to be provided to account for custom virtual environments
|
||||
"""
|
||||
try:
|
||||
proc = subprocess.Popen(['ansible', '--version'], stdout=subprocess.PIPE)
|
||||
result = smart_str(proc.communicate()[0])
|
||||
return result.split('\n')[0].replace('ansible', '').strip()
|
||||
except Exception:
|
||||
return 'unknown'
|
||||
|
||||
|
||||
def get_awx_version():
|
||||
"""
|
||||
Return AWX version as reported by setuptools.
|
||||
|
||||
Reference in New Issue
Block a user