mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Enable Ansible version to be collected from EEs
This commit is contained in:
parent
31124e07c6
commit
ef6297377b
@ -311,7 +311,7 @@ def events_table(since, full_path, until, **kwargs):
|
||||
return _copy_table(table='events', query=events_query, path=full_path)
|
||||
|
||||
|
||||
@register('unified_jobs_table', '1.2', format='csv', description=_('Data on jobs run'), expensive=True)
|
||||
@register('unified_jobs_table', '1.3', format='csv', description=_('Data on jobs run'), expensive=True)
|
||||
def unified_jobs_table(since, full_path, until, **kwargs):
|
||||
unified_job_query = '''COPY (SELECT main_unifiedjob.id,
|
||||
main_unifiedjob.polymorphic_ctype_id,
|
||||
@ -335,7 +335,8 @@ def unified_jobs_table(since, full_path, until, **kwargs):
|
||||
main_unifiedjob.elapsed,
|
||||
main_unifiedjob.job_explanation,
|
||||
main_unifiedjob.instance_group_id,
|
||||
main_unifiedjob.installed_collections
|
||||
main_unifiedjob.installed_collections,
|
||||
main_unifiedjob.ansible_version
|
||||
FROM main_unifiedjob
|
||||
JOIN django_content_type ON main_unifiedjob.polymorphic_ctype_id = django_content_type.id
|
||||
LEFT JOIN main_job ON main_unifiedjob.id = main_job.unifiedjob_ptr_id
|
||||
|
||||
18
awx/main/migrations/0133_unifiedjob_ansible_version.py
Normal file
18
awx/main/migrations/0133_unifiedjob_ansible_version.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.16 on 2021-03-16 20:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0132_instancegroup_is_container_group'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='unifiedjob',
|
||||
name='ansible_version',
|
||||
field=models.CharField(blank=True, default='', editable=False, help_text='The version of Ansible Core installed in the execution environment.', max_length=50),
|
||||
),
|
||||
]
|
||||
@ -728,6 +728,13 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
|
||||
editable=False,
|
||||
help_text=_("The Collections names and versions installed in the execution environment."),
|
||||
)
|
||||
ansible_version = models.CharField(
|
||||
max_length=50,
|
||||
blank=True,
|
||||
default='',
|
||||
editable=False,
|
||||
help_text=_("The version of Ansible Core installed in the execution environment."),
|
||||
)
|
||||
|
||||
def get_absolute_url(self, request=None):
|
||||
RealClass = self.get_real_instance_class()
|
||||
|
||||
@ -1185,6 +1185,7 @@ class BaseTask(object):
|
||||
job_profiling_dir = os.path.join(private_data_dir, 'artifacts/playbook_profiling')
|
||||
awx_profiling_dir = '/var/log/tower/playbook_profiling/'
|
||||
collections_info = os.path.join(private_data_dir, 'artifacts/', 'collections.json')
|
||||
ansible_version_file = os.path.join(private_data_dir, 'artifacts/', 'ansible_version.txt')
|
||||
|
||||
if not os.path.exists(awx_profiling_dir):
|
||||
os.mkdir(awx_profiling_dir)
|
||||
@ -1195,6 +1196,10 @@ class BaseTask(object):
|
||||
ee_collections_info = json.loads(ee_json_info.read())
|
||||
instance.installed_collections = ee_collections_info
|
||||
instance.save(update_fields=['installed_collections'])
|
||||
with open(ansible_version_file) as ee_ansible_info:
|
||||
ansible_version_info = ee_ansible_info.readline()
|
||||
instance.ansible_version = ansible_version_info
|
||||
instance.save(update_fields=['ansible_version'])
|
||||
|
||||
def event_handler(self, event_data):
|
||||
#
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user