mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Merge pull request #5723 from kdelee/scan_job_cleanup
Scan jobs have been removed, clean up old refs Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
b77ab8a6ca
@ -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}'
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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/'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user