From 6737bd4c1961e6062e94db3fcb81c743e2fb4de4 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Tue, 9 Jul 2019 13:26:58 -0400 Subject: [PATCH] Replace {} as field default values with the callable dict --- awx/main/migrations/0001_initial.py | 10 +++--- .../migrations/0002_squashed_v300_release.py | 2 +- .../migrations/0004_squashed_v310_release.py | 36 +++++++++---------- awx/main/migrations/0006_v320_release.py | 10 +++--- .../0008_v320_drop_v1_credential_fields.py | 2 +- .../0014_v330_saved_launchtime_configs.py | 18 +++++----- .../0018_v330_add_additional_stdout_events.py | 6 ++-- .../0053_v340_workflow_inventory.py | 2 +- .../0067_v350_credential_plugins.py | 2 +- awx/main/migrations/_squashed_30.py | 2 +- awx/main/models/credential/__init__.py | 8 ++--- awx/main/models/events.py | 4 +-- awx/main/models/inventory.py | 2 +- awx/main/models/jobs.py | 8 ++--- awx/main/models/mixins.py | 4 +-- awx/main/models/unified_jobs.py | 2 +- awx/main/models/workflow.py | 2 +- 17 files changed, 60 insertions(+), 60 deletions(-) diff --git a/awx/main/migrations/0001_initial.py b/awx/main/migrations/0001_initial.py index fb8a88e676..de265923a7 100644 --- a/awx/main/migrations/0001_initial.py +++ b/awx/main/migrations/0001_initial.py @@ -44,7 +44,7 @@ class Migration(migrations.Migration): ('modified', models.DateTimeField(default=None, editable=False)), ('host_name', models.CharField(default='', max_length=1024, editable=False)), ('event', models.CharField(max_length=100, choices=[('runner_on_failed', 'Host Failed'), ('runner_on_ok', 'Host OK'), ('runner_on_unreachable', 'Host Unreachable'), ('runner_on_skipped', 'Host Skipped')])), - ('event_data', jsonfield.fields.JSONField(default={}, blank=True)), + ('event_data', jsonfield.fields.JSONField(default=dict, blank=True)), ('failed', models.BooleanField(default=False, editable=False)), ('changed', models.BooleanField(default=False, editable=False)), ('counter', models.PositiveIntegerField(default=0)), @@ -198,7 +198,7 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(default=None, editable=False)), ('modified', models.DateTimeField(default=None, editable=False)), ('event', models.CharField(max_length=100, choices=[('runner_on_failed', 'Host Failed'), ('runner_on_ok', 'Host OK'), ('runner_on_error', 'Host Failure'), ('runner_on_skipped', 'Host Skipped'), ('runner_on_unreachable', 'Host Unreachable'), ('runner_on_no_hosts', 'No Hosts Remaining'), ('runner_on_async_poll', 'Host Polling'), ('runner_on_async_ok', 'Host Async OK'), ('runner_on_async_failed', 'Host Async Failure'), ('runner_on_file_diff', 'File Difference'), ('playbook_on_start', 'Playbook Started'), ('playbook_on_notify', 'Running Handlers'), ('playbook_on_no_hosts_matched', 'No Hosts Matched'), ('playbook_on_no_hosts_remaining', 'No Hosts Remaining'), ('playbook_on_task_start', 'Task Started'), ('playbook_on_vars_prompt', 'Variables Prompted'), ('playbook_on_setup', 'Gathering Facts'), ('playbook_on_import_for_host', 'internal: on Import for Host'), ('playbook_on_not_import_for_host', 'internal: on Not Import for Host'), ('playbook_on_play_start', 'Play Started'), ('playbook_on_stats', 'Playbook Complete')])), - ('event_data', jsonfield.fields.JSONField(default={}, blank=True)), + ('event_data', jsonfield.fields.JSONField(default=dict, blank=True)), ('failed', models.BooleanField(default=False, editable=False)), ('changed', models.BooleanField(default=False, editable=False)), ('host_name', models.CharField(default='', max_length=1024, editable=False)), @@ -304,7 +304,7 @@ class Migration(migrations.Migration): ('dtend', models.DateTimeField(default=None, null=True, editable=False)), ('rrule', models.CharField(max_length=255)), ('next_run', models.DateTimeField(default=None, null=True, editable=False)), - ('extra_data', jsonfield.fields.JSONField(default={}, blank=True)), + ('extra_data', jsonfield.fields.JSONField(default=dict, blank=True)), ('created_by', models.ForeignKey(related_name="{u'class': 'schedule', u'app_label': 'main'}(class)s_created+", on_delete=django.db.models.deletion.SET_NULL, default=None, editable=False, to=settings.AUTH_USER_MODEL, null=True)), ('modified_by', models.ForeignKey(related_name="{u'class': 'schedule', u'app_label': 'main'}(class)s_modified+", on_delete=django.db.models.deletion.SET_NULL, default=None, editable=False, to=settings.AUTH_USER_MODEL, null=True)), ('tags', taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', blank=True, help_text='A comma-separated list of tags.', verbose_name='Tags')), @@ -351,7 +351,7 @@ class Migration(migrations.Migration): ('elapsed', models.DecimalField(editable=False, max_digits=12, decimal_places=3)), ('job_args', models.TextField(default='', editable=False, blank=True)), ('job_cwd', models.CharField(default='', max_length=1024, editable=False, blank=True)), - ('job_env', jsonfield.fields.JSONField(default={}, editable=False, blank=True)), + ('job_env', jsonfield.fields.JSONField(default=dict, editable=False, blank=True)), ('job_explanation', models.TextField(default='', editable=False, blank=True)), ('start_args', models.TextField(default='', editable=False, blank=True)), ('result_stdout_text', models.TextField(default='', editable=False, blank=True)), @@ -463,7 +463,7 @@ class Migration(migrations.Migration): ('host_config_key', models.CharField(default='', max_length=1024, blank=True)), ('ask_variables_on_launch', models.BooleanField(default=False)), ('survey_enabled', models.BooleanField(default=False)), - ('survey_spec', jsonfield.fields.JSONField(default={}, blank=True)), + ('survey_spec', jsonfield.fields.JSONField(default=dict, blank=True)), ], options={ 'ordering': ('name',), diff --git a/awx/main/migrations/0002_squashed_v300_release.py b/awx/main/migrations/0002_squashed_v300_release.py index 9e84a889ab..28d6b00966 100644 --- a/awx/main/migrations/0002_squashed_v300_release.py +++ b/awx/main/migrations/0002_squashed_v300_release.py @@ -238,7 +238,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('timestamp', models.DateTimeField(default=None, help_text='Date and time of the corresponding fact scan gathering time.', editable=False)), ('module', models.CharField(max_length=128)), - ('facts', awx.main.fields.JSONBField(default={}, help_text='Arbitrary JSON structure of module facts captured at timestamp for a single host.', blank=True)), + ('facts', awx.main.fields.JSONBField(default=dict, help_text='Arbitrary JSON structure of module facts captured at timestamp for a single host.', blank=True)), ('host', models.ForeignKey(related_name='facts', to='main.Host', help_text='Host for the facts that the fact scan captured.')), ], ), diff --git a/awx/main/migrations/0004_squashed_v310_release.py b/awx/main/migrations/0004_squashed_v310_release.py index 965b5184d7..236c1119ca 100644 --- a/awx/main/migrations/0004_squashed_v310_release.py +++ b/awx/main/migrations/0004_squashed_v310_release.py @@ -161,7 +161,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='workflowjobnode', name='char_prompts', - field=jsonfield.fields.JSONField(default={}, blank=True), + field=jsonfield.fields.JSONField(default=dict, blank=True), ), migrations.AddField( model_name='workflowjobnode', @@ -191,7 +191,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='workflowjobtemplatenode', name='char_prompts', - field=jsonfield.fields.JSONField(default={}, blank=True), + field=jsonfield.fields.JSONField(default=dict, blank=True), ), migrations.AddField( model_name='workflowjobtemplatenode', @@ -227,12 +227,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='job', name='artifacts', - field=jsonfield.fields.JSONField(default={}, editable=False, blank=True), + field=jsonfield.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AddField( model_name='workflowjobnode', name='ancestor_artifacts', - field=jsonfield.fields.JSONField(default={}, editable=False, blank=True), + field=jsonfield.fields.JSONField(default=dict, editable=False, blank=True), ), # Job timeout settings migrations.AddField( @@ -397,7 +397,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='workflowjob', name='survey_passwords', - field=jsonfield.fields.JSONField(default={}, editable=False, blank=True), + field=jsonfield.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AddField( model_name='workflowjobtemplate', @@ -407,33 +407,33 @@ class Migration(migrations.Migration): migrations.AddField( model_name='workflowjobtemplate', name='survey_spec', - field=jsonfield.fields.JSONField(default={}, blank=True), + field=jsonfield.fields.JSONField(default=dict, blank=True), ), # JSON field changes migrations.AlterField( model_name='adhoccommandevent', name='event_data', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AlterField( model_name='job', name='artifacts', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AlterField( model_name='job', name='survey_passwords', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AlterField( model_name='jobevent', name='event_data', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AlterField( model_name='jobtemplate', name='survey_spec', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AlterField( model_name='notification', @@ -453,37 +453,37 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='schedule', name='extra_data', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AlterField( model_name='unifiedjob', name='job_env', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AlterField( model_name='workflowjob', name='survey_passwords', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AlterField( model_name='workflowjobnode', name='ancestor_artifacts', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AlterField( model_name='workflowjobnode', name='char_prompts', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AlterField( model_name='workflowjobtemplate', name='survey_spec', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AlterField( model_name='workflowjobtemplatenode', name='char_prompts', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), # Job Project Update migrations.AddField( diff --git a/awx/main/migrations/0006_v320_release.py b/awx/main/migrations/0006_v320_release.py index cda08b98c3..88cbe130ef 100644 --- a/awx/main/migrations/0006_v320_release.py +++ b/awx/main/migrations/0006_v320_release.py @@ -112,12 +112,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='fact', name='facts', - field=awx.main.fields.JSONBField(default={}, help_text='Arbitrary JSON structure of module facts captured at timestamp for a single host.', blank=True), + field=awx.main.fields.JSONBField(default=dict, help_text='Arbitrary JSON structure of module facts captured at timestamp for a single host.', blank=True), ), migrations.AddField( model_name='host', name='ansible_facts', - field=awx.main.fields.JSONBField(default={}, help_text='Arbitrary JSON structure of most recent ansible_facts, per-host.', blank=True), + field=awx.main.fields.JSONBField(default=dict, help_text='Arbitrary JSON structure of most recent ansible_facts, per-host.', blank=True), ), migrations.AddField( model_name='host', @@ -382,8 +382,8 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=512)), ('kind', models.CharField(max_length=32, choices=[('ssh', 'Machine'), ('vault', 'Vault'), ('net', 'Network'), ('scm', 'Source Control'), ('cloud', 'Cloud'), ('insights', 'Insights')])), ('managed_by_tower', models.BooleanField(default=False, editable=False)), - ('inputs', awx.main.fields.CredentialTypeInputField(default={}, blank=True, help_text='Enter inputs using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.')), - ('injectors', awx.main.fields.CredentialTypeInjectorField(default={}, blank=True, help_text='Enter injectors using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.')), + ('inputs', awx.main.fields.CredentialTypeInputField(default=dict, blank=True, help_text='Enter inputs using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.')), + ('injectors', awx.main.fields.CredentialTypeInjectorField(default=dict, blank=True, help_text='Enter injectors using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.')), ('created_by', models.ForeignKey(related_name="{u'class': 'credentialtype', u'app_label': 'main'}(class)s_created+", on_delete=models.deletion.SET_NULL, default=None, editable=False, to=settings.AUTH_USER_MODEL, null=True)), ('modified_by', models.ForeignKey(related_name="{u'class': 'credentialtype', u'app_label': 'main'}(class)s_modified+", on_delete=models.deletion.SET_NULL, default=None, editable=False, to=settings.AUTH_USER_MODEL, null=True)), ('tags', taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', blank=True, help_text='A comma-separated list of tags.', verbose_name='Tags')), @@ -399,7 +399,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='credential', name='inputs', - field=awx.main.fields.CredentialInputField(default={}, blank=True), + field=awx.main.fields.CredentialInputField(default=dict, blank=True), ), migrations.AddField( model_name='credential', diff --git a/awx/main/migrations/0008_v320_drop_v1_credential_fields.py b/awx/main/migrations/0008_v320_drop_v1_credential_fields.py index ed45bc4b8e..677221acc3 100644 --- a/awx/main/migrations/0008_v320_drop_v1_credential_fields.py +++ b/awx/main/migrations/0008_v320_drop_v1_credential_fields.py @@ -108,7 +108,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='credential', name='inputs', - field=awx.main.fields.CredentialInputField(default={}, help_text='Enter inputs using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.', blank=True), + field=awx.main.fields.CredentialInputField(default=dict, help_text='Enter inputs using either JSON or YAML syntax. Use the radio button to toggle between the two. Refer to the Ansible Tower documentation for example syntax.', blank=True), ), migrations.RemoveField( model_name='job', diff --git a/awx/main/migrations/0014_v330_saved_launchtime_configs.py b/awx/main/migrations/0014_v330_saved_launchtime_configs.py index fbd26eec1b..3d78f9d6cc 100644 --- a/awx/main/migrations/0014_v330_saved_launchtime_configs.py +++ b/awx/main/migrations/0014_v330_saved_launchtime_configs.py @@ -20,7 +20,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='schedule', name='char_prompts', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AddField( model_name='schedule', @@ -35,7 +35,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='schedule', name='survey_passwords', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AddField( model_name='workflowjobnode', @@ -45,12 +45,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='workflowjobnode', name='extra_data', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AddField( model_name='workflowjobnode', name='survey_passwords', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), migrations.AddField( model_name='workflowjobtemplatenode', @@ -60,12 +60,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='workflowjobtemplatenode', name='extra_data', - field=awx.main.fields.JSONField(default={}, blank=True), + field=awx.main.fields.JSONField(default=dict, blank=True), ), migrations.AddField( model_name='workflowjobtemplatenode', name='survey_passwords', - field=awx.main.fields.JSONField(default={}, editable=False, blank=True), + field=awx.main.fields.JSONField(default=dict, editable=False, blank=True), ), # Run data migration before removing the old credential field migrations.RunPython(migration_utils.set_current_apps_for_migrations, migrations.RunPython.noop), @@ -83,9 +83,9 @@ class Migration(migrations.Migration): name='JobLaunchConfig', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('extra_data', awx.main.fields.JSONField(blank=True, default={})), - ('survey_passwords', awx.main.fields.JSONField(blank=True, default={}, editable=False)), - ('char_prompts', awx.main.fields.JSONField(blank=True, default={})), + ('extra_data', awx.main.fields.JSONField(blank=True, default=dict)), + ('survey_passwords', awx.main.fields.JSONField(blank=True, default=dict, editable=False)), + ('char_prompts', awx.main.fields.JSONField(blank=True, default=dict)), ('credentials', models.ManyToManyField(related_name='joblaunchconfigs', to='main.Credential')), ('inventory', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='joblaunchconfigs', to='main.Inventory')), ('job', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, related_name='launch_config', to='main.UnifiedJob')), diff --git a/awx/main/migrations/0018_v330_add_additional_stdout_events.py b/awx/main/migrations/0018_v330_add_additional_stdout_events.py index 80fdbe3bf7..33abaf0eee 100644 --- a/awx/main/migrations/0018_v330_add_additional_stdout_events.py +++ b/awx/main/migrations/0018_v330_add_additional_stdout_events.py @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(default=None, editable=False)), ('modified', models.DateTimeField(default=None, editable=False)), - ('event_data', awx.main.fields.JSONField(blank=True, default={})), + ('event_data', awx.main.fields.JSONField(blank=True, default=dict)), ('uuid', models.CharField(default='', editable=False, max_length=1024)), ('counter', models.PositiveIntegerField(default=0, editable=False)), ('stdout', models.TextField(default='', editable=False)), @@ -40,7 +40,7 @@ class Migration(migrations.Migration): ('created', models.DateTimeField(default=None, editable=False)), ('modified', models.DateTimeField(default=None, editable=False)), ('event', models.CharField(choices=[('runner_on_failed', 'Host Failed'), ('runner_on_ok', 'Host OK'), ('runner_on_error', 'Host Failure'), ('runner_on_skipped', 'Host Skipped'), ('runner_on_unreachable', 'Host Unreachable'), ('runner_on_no_hosts', 'No Hosts Remaining'), ('runner_on_async_poll', 'Host Polling'), ('runner_on_async_ok', 'Host Async OK'), ('runner_on_async_failed', 'Host Async Failure'), ('runner_item_on_ok', 'Item OK'), ('runner_item_on_failed', 'Item Failed'), ('runner_item_on_skipped', 'Item Skipped'), ('runner_retry', 'Host Retry'), ('runner_on_file_diff', 'File Difference'), ('playbook_on_start', 'Playbook Started'), ('playbook_on_notify', 'Running Handlers'), ('playbook_on_include', 'Including File'), ('playbook_on_no_hosts_matched', 'No Hosts Matched'), ('playbook_on_no_hosts_remaining', 'No Hosts Remaining'), ('playbook_on_task_start', 'Task Started'), ('playbook_on_vars_prompt', 'Variables Prompted'), ('playbook_on_setup', 'Gathering Facts'), ('playbook_on_import_for_host', 'internal: on Import for Host'), ('playbook_on_not_import_for_host', 'internal: on Not Import for Host'), ('playbook_on_play_start', 'Play Started'), ('playbook_on_stats', 'Playbook Complete'), ('debug', 'Debug'), ('verbose', 'Verbose'), ('deprecated', 'Deprecated'), ('warning', 'Warning'), ('system_warning', 'System Warning'), ('error', 'Error')], max_length=100)), - ('event_data', awx.main.fields.JSONField(blank=True, default={})), + ('event_data', awx.main.fields.JSONField(blank=True, default=dict)), ('failed', models.BooleanField(default=False, editable=False)), ('changed', models.BooleanField(default=False, editable=False)), ('uuid', models.CharField(default='', editable=False, max_length=1024)), @@ -65,7 +65,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(default=None, editable=False)), ('modified', models.DateTimeField(default=None, editable=False)), - ('event_data', awx.main.fields.JSONField(blank=True, default={})), + ('event_data', awx.main.fields.JSONField(blank=True, default=dict)), ('uuid', models.CharField(default='', editable=False, max_length=1024)), ('counter', models.PositiveIntegerField(default=0, editable=False)), ('stdout', models.TextField(default='', editable=False)), diff --git a/awx/main/migrations/0053_v340_workflow_inventory.py b/awx/main/migrations/0053_v340_workflow_inventory.py index 285b4262fe..7ff40ad4c4 100644 --- a/awx/main/migrations/0053_v340_workflow_inventory.py +++ b/awx/main/migrations/0053_v340_workflow_inventory.py @@ -17,7 +17,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='workflowjob', name='char_prompts', - field=awx.main.fields.JSONField(blank=True, default={}), + field=awx.main.fields.JSONField(blank=True, default=dict), ), migrations.AddField( model_name='workflowjob', diff --git a/awx/main/migrations/0067_v350_credential_plugins.py b/awx/main/migrations/0067_v350_credential_plugins.py index e80e9f543b..32190b2bf2 100644 --- a/awx/main/migrations/0067_v350_credential_plugins.py +++ b/awx/main/migrations/0067_v350_credential_plugins.py @@ -34,7 +34,7 @@ class Migration(migrations.Migration): ('modified', models.DateTimeField(default=None, editable=False)), ('description', models.TextField(blank=True, default='')), ('input_field_name', models.CharField(max_length=1024)), - ('metadata', awx.main.fields.DynamicCredentialInputField(blank=True, default={})), + ('metadata', awx.main.fields.DynamicCredentialInputField(blank=True, default=dict)), ('created_by', models.ForeignKey(default=None, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="{'class': 'credentialinputsource', 'model_name': 'credentialinputsource', 'app_label': 'main'}(class)s_created+", to=settings.AUTH_USER_MODEL)), ('modified_by', models.ForeignKey(default=None, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="{'class': 'credentialinputsource', 'model_name': 'credentialinputsource', 'app_label': 'main'}(class)s_modified+", to=settings.AUTH_USER_MODEL)), ('source_credential', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='target_input_sources', to='main.Credential')), diff --git a/awx/main/migrations/_squashed_30.py b/awx/main/migrations/_squashed_30.py index 910be80287..31ea44e885 100644 --- a/awx/main/migrations/_squashed_30.py +++ b/awx/main/migrations/_squashed_30.py @@ -30,7 +30,7 @@ SQUASHED_30 = { migrations.AddField( model_name='job', name='survey_passwords', - field=jsonfield.fields.JSONField(default={}, editable=False, blank=True), + field=jsonfield.fields.JSONField(default=dict, editable=False, blank=True), ), ], '0031_v302_migrate_survey_passwords': [ diff --git a/awx/main/models/credential/__init__.py b/awx/main/models/credential/__init__.py index e99401ad7c..d34cac27e3 100644 --- a/awx/main/models/credential/__init__.py +++ b/awx/main/models/credential/__init__.py @@ -105,7 +105,7 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin): ) inputs = CredentialInputField( blank=True, - default={}, + default=dict, help_text=_('Enter inputs using either JSON or YAML syntax. Use the ' 'radio button to toggle between the two. Refer to the ' 'Ansible Tower documentation for example syntax.') @@ -343,14 +343,14 @@ class CredentialType(CommonModelNameNotUnique): ) inputs = CredentialTypeInputField( blank=True, - default={}, + default=dict, help_text=_('Enter inputs using either JSON or YAML syntax. Use the ' 'radio button to toggle between the two. Refer to the ' 'Ansible Tower documentation for example syntax.') ) injectors = CredentialTypeInjectorField( blank=True, - default={}, + default=dict, help_text=_('Enter injectors using either JSON or YAML syntax. Use the ' 'radio button to toggle between the two. Refer to the ' 'Ansible Tower documentation for example syntax.') @@ -1117,7 +1117,7 @@ class CredentialInputSource(PrimordialModel): ) metadata = DynamicCredentialInputField( blank=True, - default={} + default=dict ) def clean_target_credential(self): diff --git a/awx/main/models/events.py b/awx/main/models/events.py index 5b424353eb..9a70501474 100644 --- a/awx/main/models/events.py +++ b/awx/main/models/events.py @@ -149,7 +149,7 @@ class BasePlaybookEvent(CreatedModifiedModel): ) event_data = JSONField( blank=True, - default={}, + default=dict, ) failed = models.BooleanField( default=False, @@ -567,7 +567,7 @@ class BaseCommandEvent(CreatedModifiedModel): event_data = JSONField( blank=True, - default={}, + default=dict, ) uuid = models.CharField( max_length=1024, diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index a32b2da052..eec1c5ae11 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -650,7 +650,7 @@ class Host(CommonModelNameNotUnique, RelatedJobsMixin): ) ansible_facts = JSONBField( blank=True, - default={}, + default=dict, help_text=_('Arbitrary JSON structure of most recent ansible_facts, per-host.'), ) ansible_facts_modified = models.DateTimeField( diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 59b26c66e5..12c691d195 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -485,7 +485,7 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin, TaskMana ) artifacts = JSONField( blank=True, - default={}, + default=dict, editable=False, ) scm_revision = models.CharField( @@ -847,7 +847,7 @@ class LaunchTimeConfigBase(BaseModel): # This is a solution to the nullable CharField problem, specific to prompting char_prompts = JSONField( blank=True, - default={} + default=dict ) def prompts_dict(self, display=False): @@ -927,11 +927,11 @@ class LaunchTimeConfig(LaunchTimeConfigBase): # Special case prompting fields, even more special than the other ones extra_data = JSONField( blank=True, - default={} + default=dict ) survey_passwords = prevent_search(JSONField( blank=True, - default={}, + default=dict, editable=False, )) # Credentials needed for non-unified job / unified JT models diff --git a/awx/main/models/mixins.py b/awx/main/models/mixins.py index 437388664a..47176f2550 100644 --- a/awx/main/models/mixins.py +++ b/awx/main/models/mixins.py @@ -100,7 +100,7 @@ class SurveyJobTemplateMixin(models.Model): ) survey_spec = prevent_search(JSONField( blank=True, - default={}, + default=dict, )) ask_variables_on_launch = AskForField( blank=True, @@ -360,7 +360,7 @@ class SurveyJobMixin(models.Model): survey_passwords = prevent_search(JSONField( blank=True, - default={}, + default=dict, editable=False, )) diff --git a/awx/main/models/unified_jobs.py b/awx/main/models/unified_jobs.py index 438cc5f513..e0de362e8e 100644 --- a/awx/main/models/unified_jobs.py +++ b/awx/main/models/unified_jobs.py @@ -641,7 +641,7 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique ) job_env = prevent_search(JSONField( blank=True, - default={}, + default=dict, editable=False, )) job_explanation = models.TextField( diff --git a/awx/main/models/workflow.py b/awx/main/models/workflow.py index e5f36054ff..d413f05666 100644 --- a/awx/main/models/workflow.py +++ b/awx/main/models/workflow.py @@ -180,7 +180,7 @@ class WorkflowJobNode(WorkflowNodeBase): ) ancestor_artifacts = JSONField( blank=True, - default={}, + default=dict, editable=False, ) do_not_run = models.BooleanField(