diff --git a/awx/main/fields.py b/awx/main/fields.py index 36ba0c8394..4e854bbb8b 100644 --- a/awx/main/fields.py +++ b/awx/main/fields.py @@ -199,7 +199,6 @@ def update_role_parentage_for_instance(instance): updates the parents listing for all the roles of a given instance if they have changed ''' - changed_ct = 0 parents_removed = set() parents_added = set() for implicit_role_field in getattr(instance.__class__, '__implicit_role_fields'): diff --git a/awx/main/migrations/0107_v370_job_template_organization_field.py b/awx/main/migrations/0109_v370_job_template_organization_field.py similarity index 98% rename from awx/main/migrations/0107_v370_job_template_organization_field.py rename to awx/main/migrations/0109_v370_job_template_organization_field.py index 11fd247f5c..505538594a 100644 --- a/awx/main/migrations/0107_v370_job_template_organization_field.py +++ b/awx/main/migrations/0109_v370_job_template_organization_field.py @@ -19,7 +19,7 @@ def rebuild_jt_parents(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('main', '0106_v370_remove_inventory_groups_with_active_failures'), + ('main', '0108_v370_unifiedjob_dependencies_processed'), ] operations = [ diff --git a/awx/main/models/projects.py b/awx/main/models/projects.py index aad612ebd8..0207fec97b 100644 --- a/awx/main/models/projects.py +++ b/awx/main/models/projects.py @@ -584,8 +584,8 @@ class ProjectUpdate(UnifiedJob, ProjectOptions, JobNotificationMixin, TaskManage @property def preferred_instance_groups(self): - if self.project is not None and self.project.organization is not None: - organization_groups = [x for x in self.project.organization.instance_groups.all()] + if self.organization is not None: + organization_groups = [x for x in self.organization.instance_groups.all()] else: organization_groups = [] template_groups = [x for x in super(ProjectUpdate, self).preferred_instance_groups] diff --git a/awx/main/tests/functional/api/test_deprecated_credential_assignment.py b/awx/main/tests/functional/api/test_deprecated_credential_assignment.py index b837af5a84..880b7ff892 100644 --- a/awx/main/tests/functional/api/test_deprecated_credential_assignment.py +++ b/awx/main/tests/functional/api/test_deprecated_credential_assignment.py @@ -278,7 +278,6 @@ def test_multi_vault_preserved_on_put(get, put, admin_user, job_template, vault_ job_template.credentials.add(vault_credential, vault2) assert job_template.credentials.count() == 2 # sanity check r = get(job_template.get_absolute_url(), admin_user, expect=200) - r.data.pop('organization') # so that it passes validation # should be a no-op PUT request put( job_template.get_absolute_url(), diff --git a/awx/main/tests/functional/api/test_unified_job_template.py b/awx/main/tests/functional/api/test_unified_job_template.py index c2df65b49f..3aa6c4024e 100644 --- a/awx/main/tests/functional/api/test_unified_job_template.py +++ b/awx/main/tests/functional/api/test_unified_job_template.py @@ -2,7 +2,6 @@ import pytest from awx.api.versioning import reverse from awx.main import models -from awx.main.utils import get_type_for_model @pytest.mark.django_db diff --git a/awx/main/tests/functional/test_instances.py b/awx/main/tests/functional/test_instances.py index 67331a6973..927e5fb440 100644 --- a/awx/main/tests/functional/test_instances.py +++ b/awx/main/tests/functional/test_instances.py @@ -1,7 +1,7 @@ import pytest from unittest import mock -from awx.main.models import AdHocCommand, InventoryUpdate, Job, JobTemplate, ProjectUpdate +from awx.main.models import AdHocCommand, InventoryUpdate, JobTemplate, ProjectUpdate from awx.main.models.ha import Instance, InstanceGroup from awx.main.tasks import apply_cluster_membership_policies from awx.api.versioning import reverse @@ -310,7 +310,7 @@ class TestInstanceGroupOrdering: assert iu.preferred_instance_groups == [ig_inv, ig_org] def test_project_update_instance_groups(self, instance_group_factory, project, default_instance_group): - pu = ProjectUpdate.objects.create(project=project) + pu = ProjectUpdate.objects.create(project=project, organization=project.organization) assert pu.preferred_instance_groups == [default_instance_group] ig_org = instance_group_factory("OrgIstGrp", [default_instance_group.instances.first()]) ig_tmp = instance_group_factory("TmpIstGrp", [default_instance_group.instances.first()]) diff --git a/awx/main/tests/functional/test_rbac_job.py b/awx/main/tests/functional/test_rbac_job.py index 1c096e74c7..ed3aee47cb 100644 --- a/awx/main/tests/functional/test_rbac_job.py +++ b/awx/main/tests/functional/test_rbac_job.py @@ -21,8 +21,6 @@ from awx.main.models import ( Credential ) -from rest_framework.exceptions import PermissionDenied - from crum import impersonate diff --git a/awx/ui/client/src/templates/job_templates/job-template.form.js b/awx/ui/client/src/templates/job_templates/job-template.form.js index 953dcbbd55..6f1f8cf025 100644 --- a/awx/ui/client/src/templates/job_templates/job-template.form.js +++ b/awx/ui/client/src/templates/job_templates/job-template.form.js @@ -43,19 +43,6 @@ function(NotificationsList, i18n) { column: 1, ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)' }, - organization: { - label: i18n._('Organization'), - type: 'lookup', - list: 'OrganizationList', - sourceModel: 'organization', - basePath: 'organizations', - sourceField: 'name', - dataTitle: i18n._('Organization'), - dataContainer: 'body', - dataPlacement: 'right', - ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)', - awLookupWhen: '(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)' - }, job_type: { label: i18n._('Job Type'), type: 'select', diff --git a/awxkit/awxkit/api/resources.py b/awxkit/awxkit/api/resources.py index d317bcc55d..97a9c31c90 100644 --- a/awxkit/awxkit/api/resources.py +++ b/awxkit/awxkit/api/resources.py @@ -63,7 +63,6 @@ class Resources(object): _inventory_related_root_groups = r'inventories/\d+/root_groups/' _inventory_related_script = r'inventories/\d+/script/' _inventory_related_update_inventory_sources = r'inventories/\d+/update_inventory_sources/' - _inventory_scan_job_templates = r'inventories/\d+/scan_job_templates/' _inventory_script = r'inventory_scripts/\d+/' _inventory_script_copy = r'inventory_scripts/\d+/copy/' _inventory_scripts = 'inventory_scripts/'