mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 01:38:50 -03:30
add a unique UUID for identifying an AWX installation
This commit is contained in:
@@ -100,7 +100,7 @@ class SettingsRegistry(object):
|
|||||||
if kwargs.get('category_slug', None) in slugs_to_ignore:
|
if kwargs.get('category_slug', None) in slugs_to_ignore:
|
||||||
continue
|
continue
|
||||||
if (read_only in {True, False} and kwargs.get('read_only', False) != read_only and
|
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__;
|
# Note: Doesn't catch fields that set read_only via __init__;
|
||||||
# read-only field kwargs should always include read_only=True.
|
# read-only field kwargs should always include read_only=True.
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -381,8 +381,9 @@ class SettingsWrapper(UserSettingsHolder):
|
|||||||
setting = None
|
setting = None
|
||||||
setting_id = None
|
setting_id = None
|
||||||
if not field.read_only or name in (
|
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
|
# to fetch their value from the database
|
||||||
|
'INSTALL_UUID',
|
||||||
'AWX_ISOLATED_PRIVATE_KEY',
|
'AWX_ISOLATED_PRIVATE_KEY',
|
||||||
'AWX_ISOLATED_PUBLIC_KEY',
|
'AWX_ISOLATED_PUBLIC_KEY',
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ def config(since):
|
|||||||
'release': platform.release(),
|
'release': platform.release(),
|
||||||
'type': install_type,
|
'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_url_base': settings.TOWER_URL_BASE,
|
||||||
'tower_version': get_awx_version(),
|
'tower_version': get_awx_version(),
|
||||||
'ansible_version': get_ansible_version(),
|
'ansible_version': get_ansible_version(),
|
||||||
|
|||||||
@@ -126,6 +126,15 @@ register(
|
|||||||
category_slug='system',
|
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(
|
register(
|
||||||
'CUSTOM_VENV_PATHS',
|
'CUSTOM_VENV_PATHS',
|
||||||
field_class=fields.StringListPathField,
|
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)
|
fields[log_name] = getattr(settings, setting_name, None)
|
||||||
elif log_name == 'type':
|
elif log_name == 'type':
|
||||||
fields[log_name] = 'other'
|
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
|
return fields
|
||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
|
|||||||
Reference in New Issue
Block a user