fix job_type change 500 error, patch up runtime tests

This commit is contained in:
AlanCoding
2016-05-17 17:01:51 -04:00
parent 9ba98d9cac
commit f19088db1b
2 changed files with 43 additions and 17 deletions

View File

@@ -2287,7 +2287,7 @@ class JobLaunchSerializer(BaseSerializer):
# Special prohibited cases for scan jobs
if 'job_type' in data and obj.ask_job_type_on_launch:
if ((obj.job_type==PERM_INVENTORY_SCAN and not data['job_type']==PERM_INVENTORY_SCAN) or
(data['job_type']==PERM_INVENTORY_SCAN and not obj['job_type']==PERM_INVENTORY_SCAN)):
(data['job_type']==PERM_INVENTORY_SCAN and not obj.job_type==PERM_INVENTORY_SCAN)):
errors['job_type'] = 'Can not override job_type to or from a scan job.'
if (obj.job_type==PERM_INVENTORY_SCAN and ('inventory' in data) and obj.ask_inventory_on_launch and
obj.inventory != data['inventory']):