Various JT.organization cleanup items

cleanup from PR review suggestions

bump migration number

fix test

revert change to old-app JT form no longer needed
This commit is contained in:
AlanCoding 2020-02-06 11:37:45 -05:00
parent 7547793792
commit aa4842aea5
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B
9 changed files with 5 additions and 24 deletions

View File

@ -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'):

View File

@ -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 = [

View File

@ -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]

View File

@ -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(),

View File

@ -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

View File

@ -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()])

View File

@ -21,8 +21,6 @@ from awx.main.models import (
Credential
)
from rest_framework.exceptions import PermissionDenied
from crum import impersonate

View File

@ -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',

View File

@ -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/'