diff --git a/awx/main/tests/functional/api/test_job_runtime_params.py b/awx/main/tests/functional/api/test_job_runtime_params.py index c2cd279bab..4d86b8dd07 100644 --- a/awx/main/tests/functional/api/test_job_runtime_params.py +++ b/awx/main/tests/functional/api/test_job_runtime_params.py @@ -264,18 +264,6 @@ def test_job_launch_fails_without_credential_access(job_template_prompts, runtim dict(credentials=runtime_data['credentials']), rando, expect=403) -@pytest.mark.django_db -@pytest.mark.job_runtime_vars -def test_job_block_scan_job_type_change(job_template_prompts, post, admin_user): - job_template = job_template_prompts(True) - - # Assure that changing the type of a scan job blocks the launch - response = post(reverse('api:job_template_launch', kwargs={'pk':job_template.pk}), - dict(job_type='scan'), admin_user, expect=400) - - assert 'job_type' in response.data - - @pytest.mark.django_db def test_job_launch_JT_with_validation(machine_credential, credential, deploy_jobtemplate): deploy_jobtemplate.extra_vars = '{"job_template_var": 3}' diff --git a/awx/main/tests/unit/test_access.py b/awx/main/tests/unit/test_access.py index adb2b2dcae..f95e6dbd4d 100644 --- a/awx/main/tests/unit/test_access.py +++ b/awx/main/tests/unit/test_access.py @@ -197,36 +197,6 @@ def test_change_jt_sensitive_data(job_template_with_ids, mocker, user_unit): }) -def test_jt_add_scan_job_check(job_template_with_ids, user_unit): - "Assure that permissions to add scan jobs work correctly" - - access = JobTemplateAccess(user_unit) - project = job_template_with_ids.project - inventory = job_template_with_ids.inventory - project.use_role = Role() - inventory.use_role = Role() - organization = Organization(name='test-org') - inventory.organization = organization - organization.admin_role = Role() - - def mock_get_object(Class, **kwargs): - if Class == Project: - return project - elif Class == Inventory: - return inventory - else: - raise Exception('Item requested has not been mocked') - - - with mock.patch('awx.main.models.rbac.Role.__contains__', return_value=True): - with mock.patch('awx.main.access.get_object_or_400', mock_get_object): - assert access.can_add({ - 'project': project.pk, - 'inventory': inventory.pk, - 'job_type': 'scan' - }) - - def mock_raise_none(self, add_host=False, feature=None, check_expiration=True): return None diff --git a/awx_collection/plugins/modules/tower_job_launch.py b/awx_collection/plugins/modules/tower_job_launch.py index 7a85e3c82c..77b73a7eac 100644 --- a/awx_collection/plugins/modules/tower_job_launch.py +++ b/awx_collection/plugins/modules/tower_job_launch.py @@ -31,7 +31,7 @@ options: job_type: description: - Job_type to use for the job, only used if prompt for job_type is set. - choices: ["run", "check", "scan"] + choices: ["run", "check"] type: str inventory: description: @@ -145,7 +145,7 @@ def update_fields(module, p): def main(): argument_spec = dict( job_template=dict(required=True, type='str'), - job_type=dict(choices=['run', 'check', 'scan']), + job_type=dict(choices=['run', 'check']), inventory=dict(type='str', default=None), credential=dict(type='str', default=None), limit=dict(), diff --git a/awxkit/awxkit/api/pages/job_templates.py b/awxkit/awxkit/api/pages/job_templates.py index e7d74f7cec..d8fc58acb4 100644 --- a/awxkit/awxkit/api/pages/job_templates.py +++ b/awxkit/awxkit/api/pages/job_templates.py @@ -131,8 +131,6 @@ class JobTemplate( inventory=Inventory, project=None, **kwargs): - if not project and job_type != 'scan': - project = Project if not inventory and not kwargs.get('ask_inventory_on_launch', False): inventory = Inventory 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/'