From 6adf4ca2c10ee56f185e6397ecaf5bdccceef7ea Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 18 Apr 2019 12:12:50 -0400 Subject: [PATCH 1/2] Deprecate a bunch of inventory computed fields. Cribbed from https://github.com/ansible/awx/pull/3281/ --- awx/main/models/inventory.py | 42 ++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index dab2b395dc..ab2af142b1 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -100,32 +100,38 @@ class Inventory(CommonModelNameNotUnique, ResourceMixin, RelatedJobsMixin): has_active_failures = models.BooleanField( default=False, editable=False, - help_text=_('Flag indicating whether any hosts in this inventory have failed.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Flag indicating whether any hosts in this inventory have failed.'), ) total_hosts = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Total number of hosts in this inventory.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Total number of hosts in this inventory.'), ) hosts_with_active_failures = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Number of hosts in this inventory with active failures.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Number of hosts in this inventory with active failures.'), ) total_groups = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Total number of groups in this inventory.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Total number of groups in this inventory.'), ) groups_with_active_failures = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Number of groups in this inventory with active failures.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Number of groups in this inventory with active failures.'), ) has_inventory_sources = models.BooleanField( default=False, editable=False, - help_text=_('Flag indicating whether this inventory has any external inventory sources.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Flag indicating whether this inventory has any external inventory sources.'), ) total_inventory_sources = models.PositiveIntegerField( default=0, @@ -625,12 +631,14 @@ class Host(CommonModelNameNotUnique, RelatedJobsMixin): has_active_failures = models.BooleanField( default=False, editable=False, - help_text=_('Flag indicating whether the last job failed for this host.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Flag indicating whether the last job failed for this host.'), ) has_inventory_sources = models.BooleanField( default=False, editable=False, - help_text=_('Flag indicating whether this host was created/updated from any external inventory sources.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Flag indicating whether this host was created/updated from any external inventory sources.'), ) inventory_sources = models.ManyToManyField( 'InventorySource', @@ -800,32 +808,38 @@ class Group(CommonModelNameNotUnique, RelatedJobsMixin): total_hosts = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Total number of hosts directly or indirectly in this group.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Total number of hosts directly or indirectly in this group.'), ) has_active_failures = models.BooleanField( default=False, editable=False, - help_text=_('Flag indicating whether this group has any hosts with active failures.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Flag indicating whether this group has any hosts with active failures.'), ) hosts_with_active_failures = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Number of hosts in this group with active failures.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Number of hosts in this group with active failures.'), ) total_groups = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Total number of child groups contained within this group.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Total number of child groups contained within this group.'), ) groups_with_active_failures = models.PositiveIntegerField( default=0, editable=False, - help_text=_('Number of child groups within this group that have active failures.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Number of child groups within this group that have active failures.'), ) has_inventory_sources = models.BooleanField( default=False, editable=False, - help_text=_('Flag indicating whether this group was created/updated from any external inventory sources.'), + help_text=_('This field is deprecated and will be removed in a future release. ' + 'Flag indicating whether this group was created/updated from any external inventory sources.'), ) inventory_sources = models.ManyToManyField( 'InventorySource', From ef7e1afa3422519d9ae6528e3965716c53137dce Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 18 Apr 2019 15:39:47 -0400 Subject: [PATCH 2/2] Add migrations for field names. --- .../migrations/0072_v350_deprecate_fields.py | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 awx/main/migrations/0072_v350_deprecate_fields.py diff --git a/awx/main/migrations/0072_v350_deprecate_fields.py b/awx/main/migrations/0072_v350_deprecate_fields.py new file mode 100644 index 0000000000..923a6d671c --- /dev/null +++ b/awx/main/migrations/0072_v350_deprecate_fields.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.20 on 2019-04-18 19:37 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0071_v350_remove_system_tracking'), + ] + + operations = [ + migrations.AlterField( + model_name='group', + name='groups_with_active_failures', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Number of child groups within this group that have active failures.'), + ), + migrations.AlterField( + model_name='group', + name='has_active_failures', + field=models.BooleanField(default=False, editable=False, help_text='This field is deprecated and will be removed in a future release. Flag indicating whether this group has any hosts with active failures.'), + ), + migrations.AlterField( + model_name='group', + name='has_inventory_sources', + field=models.BooleanField(default=False, editable=False, help_text='This field is deprecated and will be removed in a future release. Flag indicating whether this group was created/updated from any external inventory sources.'), + ), + migrations.AlterField( + model_name='group', + name='hosts_with_active_failures', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Number of hosts in this group with active failures.'), + ), + migrations.AlterField( + model_name='group', + name='total_groups', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Total number of child groups contained within this group.'), + ), + migrations.AlterField( + model_name='group', + name='total_hosts', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Total number of hosts directly or indirectly in this group.'), + ), + migrations.AlterField( + model_name='host', + name='has_active_failures', + field=models.BooleanField(default=False, editable=False, help_text='This field is deprecated and will be removed in a future release. Flag indicating whether the last job failed for this host.'), + ), + migrations.AlterField( + model_name='host', + name='has_inventory_sources', + field=models.BooleanField(default=False, editable=False, help_text='This field is deprecated and will be removed in a future release. Flag indicating whether this host was created/updated from any external inventory sources.'), + ), + migrations.AlterField( + model_name='inventory', + name='groups_with_active_failures', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Number of groups in this inventory with active failures.'), + ), + migrations.AlterField( + model_name='inventory', + name='has_active_failures', + field=models.BooleanField(default=False, editable=False, help_text='This field is deprecated and will be removed in a future release. Flag indicating whether any hosts in this inventory have failed.'), + ), + migrations.AlterField( + model_name='inventory', + name='has_inventory_sources', + field=models.BooleanField(default=False, editable=False, help_text='This field is deprecated and will be removed in a future release. Flag indicating whether this inventory has any external inventory sources.'), + ), + migrations.AlterField( + model_name='inventory', + name='hosts_with_active_failures', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Number of hosts in this inventory with active failures.'), + ), + migrations.AlterField( + model_name='inventory', + name='total_groups', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Total number of groups in this inventory.'), + ), + migrations.AlterField( + model_name='inventory', + name='total_hosts', + field=models.PositiveIntegerField(default=0, editable=False, help_text='This field is deprecated and will be removed in a future release. Total number of hosts in this inventory.'), + ), + ]