mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Make sure we check arguments passed to signal start before allowing it
to proceed.
This commit is contained in:
parent
20285e18e5
commit
e6209d4d4f
@ -765,6 +765,13 @@ class InventoryUpdate(CommonTask):
|
||||
return 50
|
||||
|
||||
def signal_start(self, **kwargs):
|
||||
if not self.can_start:
|
||||
return False
|
||||
needed = self._get_passwords_needed_to_start()
|
||||
opts = dict([(field, kwargs.get(field, '')) for field in needed])
|
||||
if not all(opts.values()):
|
||||
return False
|
||||
|
||||
json_args = json.dumps(kwargs)
|
||||
self.start_args = json_args
|
||||
self.save()
|
||||
|
||||
@ -385,6 +385,13 @@ class Job(CommonTask):
|
||||
return dependencies
|
||||
|
||||
def signal_start(self, **kwargs):
|
||||
if not self.can_start:
|
||||
return False
|
||||
needed = self._get_passwords_needed_to_start()
|
||||
opts = dict([(field, kwargs.get(field, '')) for field in needed])
|
||||
if not all(opts.values()):
|
||||
return False
|
||||
|
||||
json_args = json.dumps(kwargs)
|
||||
self.start_args = json_args
|
||||
self.save()
|
||||
|
||||
@ -377,6 +377,13 @@ class ProjectUpdate(CommonTask):
|
||||
return 20
|
||||
|
||||
def signal_start(self, **kwargs):
|
||||
if not self.can_start:
|
||||
return False
|
||||
needed = self._get_passwords_needed_to_start()
|
||||
opts = dict([(field, kwargs.get(field, '')) for field in needed])
|
||||
if not all(opts.values()):
|
||||
return False
|
||||
|
||||
json_args = json.dumps(kwargs)
|
||||
self.start_args = json_args
|
||||
self.save()
|
||||
|
||||
@ -648,7 +648,6 @@ class RunJobTest(BaseCeleryTest):
|
||||
self.assertFalse(job.passwords_needed_to_start)
|
||||
self.build_args_callback = self._cancel_job_callback
|
||||
self.assertTrue(job.signal_start())
|
||||
self.assertEqual(job.status, 'waiting')
|
||||
job = Job.objects.get(pk=job.pk)
|
||||
self.check_job_result(job, 'canceled')
|
||||
self.assertEqual(job.cancel_flag, True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user