mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
Merge pull request #3637 from ryanpetrello/install-uuid
add a unique UUID for identifying an AWX installation Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
commit
67aeecdee5
@ -100,7 +100,7 @@ class SettingsRegistry(object):
|
||||
if kwargs.get('category_slug', None) in slugs_to_ignore:
|
||||
continue
|
||||
if (read_only in {True, False} and kwargs.get('read_only', False) != read_only and
|
||||
setting not in ('AWX_ISOLATED_PRIVATE_KEY', 'AWX_ISOLATED_PUBLIC_KEY')):
|
||||
setting not in ('INSTALL_UUID', 'AWX_ISOLATED_PRIVATE_KEY', 'AWX_ISOLATED_PUBLIC_KEY')):
|
||||
# Note: Doesn't catch fields that set read_only via __init__;
|
||||
# read-only field kwargs should always include read_only=True.
|
||||
continue
|
||||
|
||||
@ -381,8 +381,9 @@ class SettingsWrapper(UserSettingsHolder):
|
||||
setting = None
|
||||
setting_id = None
|
||||
if not field.read_only or name in (
|
||||
# these two values are read-only - however - we *do* want
|
||||
# these values are read-only - however - we *do* want
|
||||
# to fetch their value from the database
|
||||
'INSTALL_UUID',
|
||||
'AWX_ISOLATED_PRIVATE_KEY',
|
||||
'AWX_ISOLATED_PUBLIC_KEY',
|
||||
):
|
||||
|
||||
@ -46,7 +46,8 @@ def config(since):
|
||||
'release': platform.release(),
|
||||
'type': install_type,
|
||||
},
|
||||
'system_uuid': settings.SYSTEM_UUID,
|
||||
'install_uuid': settings.INSTALL_UUID,
|
||||
'instance_uuid': settings.SYSTEM_UUID,
|
||||
'tower_url_base': settings.TOWER_URL_BASE,
|
||||
'tower_version': get_awx_version(),
|
||||
'ansible_version': get_ansible_version(),
|
||||
|
||||
@ -126,6 +126,15 @@ register(
|
||||
category_slug='system',
|
||||
)
|
||||
|
||||
register(
|
||||
'INSTALL_UUID',
|
||||
field_class=fields.CharField,
|
||||
label=_('Unique identifier for an AWX/Tower installation'),
|
||||
category=_('System'),
|
||||
category_slug='system',
|
||||
read_only=True,
|
||||
)
|
||||
|
||||
register(
|
||||
'CUSTOM_VENV_PATHS',
|
||||
field_class=fields.StringListPathField,
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.16 on 2019-04-05 20:19
|
||||
from __future__ import unicode_literals
|
||||
from uuid import uuid4
|
||||
|
||||
from django.db import migrations, models
|
||||
from django.utils.timezone import now
|
||||
|
||||
|
||||
def _gen_install_uuid(apps, schema_editor):
|
||||
Setting = apps.get_model('conf', 'Setting')
|
||||
Setting(
|
||||
key='INSTALL_UUID',
|
||||
value=str(uuid4()),
|
||||
created=now(),
|
||||
modified=now(),
|
||||
).save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0068_v350_index_event_created'),
|
||||
]
|
||||
|
||||
operations = [migrations.RunPython(_gen_install_uuid)]
|
||||
@ -237,6 +237,13 @@ class LogstashFormatter(LogstashFormatterBase):
|
||||
fields[log_name] = getattr(settings, setting_name, None)
|
||||
elif log_name == 'type':
|
||||
fields[log_name] = 'other'
|
||||
|
||||
uuid = (
|
||||
getattr(settings, 'LOG_AGGREGATOR_TOWER_UUID', None) or
|
||||
getattr(settings, 'INSTALL_UUID', None)
|
||||
)
|
||||
if uuid:
|
||||
fields['tower_uuid'] = uuid
|
||||
return fields
|
||||
|
||||
def format(self, record):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user