mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Merge pull request #9598 from beeankha/ansible_version_analytics
Enable Ansible version to be collected from EEs SUMMARY Connecting issue #9473 This PR, along with this Ansible-Runner PR, enables us to obtain the Ansible (core) version for each execution environment that is utilized. This info can be gathered from the new ansible_version column on the main_unifiedjobs table. ISSUE TYPE Feature Pull Request COMPONENT NAME API AWX VERSION awx: 17.0.1 ADDITIONAL INFORMATION Screenshot/example of the DB output: Reviewed-by: Ryan Petrello <None> Reviewed-by: Bianca Henderson <beeankha@gmail.com> Reviewed-by: Ladislav Smola <lsmola@redhat.com> Reviewed-by: Shane McDonald <me@shanemcd.com>
This commit is contained in:
commit
012902f4fe
@ -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/0134_unifiedjob_ansible_version.py
Normal file
18
awx/main/migrations/0134_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', '0133_centrify_vault_credtype'),
|
||||
]
|
||||
|
||||
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=255),
|
||||
),
|
||||
]
|
||||
@ -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=255,
|
||||
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,11 @@ class BaseTask(object):
|
||||
ee_collections_info = json.loads(ee_json_info.read())
|
||||
instance.installed_collections = ee_collections_info
|
||||
instance.save(update_fields=['installed_collections'])
|
||||
if os.path.exists(ansible_version_file):
|
||||
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