mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
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:
@@ -199,7 +199,6 @@ def update_role_parentage_for_instance(instance):
|
|||||||
updates the parents listing for all the roles
|
updates the parents listing for all the roles
|
||||||
of a given instance if they have changed
|
of a given instance if they have changed
|
||||||
'''
|
'''
|
||||||
changed_ct = 0
|
|
||||||
parents_removed = set()
|
parents_removed = set()
|
||||||
parents_added = set()
|
parents_added = set()
|
||||||
for implicit_role_field in getattr(instance.__class__, '__implicit_role_fields'):
|
for implicit_role_field in getattr(instance.__class__, '__implicit_role_fields'):
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ def rebuild_jt_parents(apps, schema_editor):
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('main', '0106_v370_remove_inventory_groups_with_active_failures'),
|
('main', '0108_v370_unifiedjob_dependencies_processed'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@@ -584,8 +584,8 @@ class ProjectUpdate(UnifiedJob, ProjectOptions, JobNotificationMixin, TaskManage
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def preferred_instance_groups(self):
|
def preferred_instance_groups(self):
|
||||||
if self.project is not None and self.project.organization is not None:
|
if self.organization is not None:
|
||||||
organization_groups = [x for x in self.project.organization.instance_groups.all()]
|
organization_groups = [x for x in self.organization.instance_groups.all()]
|
||||||
else:
|
else:
|
||||||
organization_groups = []
|
organization_groups = []
|
||||||
template_groups = [x for x in super(ProjectUpdate, self).preferred_instance_groups]
|
template_groups = [x for x in super(ProjectUpdate, self).preferred_instance_groups]
|
||||||
|
|||||||
@@ -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)
|
job_template.credentials.add(vault_credential, vault2)
|
||||||
assert job_template.credentials.count() == 2 # sanity check
|
assert job_template.credentials.count() == 2 # sanity check
|
||||||
r = get(job_template.get_absolute_url(), admin_user, expect=200)
|
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
|
# should be a no-op PUT request
|
||||||
put(
|
put(
|
||||||
job_template.get_absolute_url(),
|
job_template.get_absolute_url(),
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import pytest
|
|||||||
|
|
||||||
from awx.api.versioning import reverse
|
from awx.api.versioning import reverse
|
||||||
from awx.main import models
|
from awx.main import models
|
||||||
from awx.main.utils import get_type_for_model
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from unittest import mock
|
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.models.ha import Instance, InstanceGroup
|
||||||
from awx.main.tasks import apply_cluster_membership_policies
|
from awx.main.tasks import apply_cluster_membership_policies
|
||||||
from awx.api.versioning import reverse
|
from awx.api.versioning import reverse
|
||||||
@@ -310,7 +310,7 @@ class TestInstanceGroupOrdering:
|
|||||||
assert iu.preferred_instance_groups == [ig_inv, ig_org]
|
assert iu.preferred_instance_groups == [ig_inv, ig_org]
|
||||||
|
|
||||||
def test_project_update_instance_groups(self, instance_group_factory, project, default_instance_group):
|
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]
|
assert pu.preferred_instance_groups == [default_instance_group]
|
||||||
ig_org = instance_group_factory("OrgIstGrp", [default_instance_group.instances.first()])
|
ig_org = instance_group_factory("OrgIstGrp", [default_instance_group.instances.first()])
|
||||||
ig_tmp = instance_group_factory("TmpIstGrp", [default_instance_group.instances.first()])
|
ig_tmp = instance_group_factory("TmpIstGrp", [default_instance_group.instances.first()])
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ from awx.main.models import (
|
|||||||
Credential
|
Credential
|
||||||
)
|
)
|
||||||
|
|
||||||
from rest_framework.exceptions import PermissionDenied
|
|
||||||
|
|
||||||
from crum import impersonate
|
from crum import impersonate
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,19 +43,6 @@ function(NotificationsList, i18n) {
|
|||||||
column: 1,
|
column: 1,
|
||||||
ngDisabled: '!(job_template_obj.summary_fields.user_capabilities.edit || canAddJobTemplate)'
|
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: {
|
job_type: {
|
||||||
label: i18n._('Job Type'),
|
label: i18n._('Job Type'),
|
||||||
type: 'select',
|
type: 'select',
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class Resources(object):
|
|||||||
_inventory_related_root_groups = r'inventories/\d+/root_groups/'
|
_inventory_related_root_groups = r'inventories/\d+/root_groups/'
|
||||||
_inventory_related_script = r'inventories/\d+/script/'
|
_inventory_related_script = r'inventories/\d+/script/'
|
||||||
_inventory_related_update_inventory_sources = r'inventories/\d+/update_inventory_sources/'
|
_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 = r'inventory_scripts/\d+/'
|
||||||
_inventory_script_copy = r'inventory_scripts/\d+/copy/'
|
_inventory_script_copy = r'inventory_scripts/\d+/copy/'
|
||||||
_inventory_scripts = 'inventory_scripts/'
|
_inventory_scripts = 'inventory_scripts/'
|
||||||
|
|||||||
Reference in New Issue
Block a user