mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
Make sure we are passing arguments down for inventory and project update
actions. Fix up some unit tests.
This commit is contained in:
parent
3c82085b93
commit
fbafa22a5a
@ -708,7 +708,7 @@ class InventorySource(PrimordialModel):
|
||||
def update(self, **kwargs):
|
||||
if self.can_update:
|
||||
inventory_update = self.inventory_updates.create()
|
||||
inventory_update.signal_start()
|
||||
inventory_update.signal_start(**kwargs)
|
||||
return inventory_update
|
||||
|
||||
def get_absolute_url(self):
|
||||
@ -764,6 +764,11 @@ class InventoryUpdate(CommonTask):
|
||||
return 50
|
||||
|
||||
def signal_start(self, **kwargs):
|
||||
json_args = json.dumps(kwargs)
|
||||
self.start_args = json_args
|
||||
self.save()
|
||||
self.start_args = encrypt_field(self, 'start_args')
|
||||
self.save()
|
||||
signal_context = zmq.Context()
|
||||
signal_socket = signal_context.socket(zmq.REQ)
|
||||
signal_socket.connect(settings.TASK_COMMAND_PORT)
|
||||
|
||||
@ -294,7 +294,7 @@ class Project(CommonModel):
|
||||
def update(self, **kwargs):
|
||||
if self.can_update:
|
||||
project_update = self.project_updates.create()
|
||||
project_update.signal_start()
|
||||
project_update.signal_start(**kwargs)
|
||||
return project_update
|
||||
|
||||
def get_absolute_url(self):
|
||||
@ -376,6 +376,11 @@ class ProjectUpdate(CommonTask):
|
||||
return 20
|
||||
|
||||
def signal_start(self, **kwargs):
|
||||
json_args = json.dumps(kwargs)
|
||||
self.start_args = json_args
|
||||
self.save()
|
||||
self.start_args = encrypt_field(self, 'start_args')
|
||||
self.save()
|
||||
signal_context = zmq.Context()
|
||||
signal_socket = signal_context.socket(zmq.REQ)
|
||||
signal_socket.connect(settings.TASK_COMMAND_PORT)
|
||||
|
||||
@ -402,7 +402,7 @@ class CleanupJobsTest(BaseCommandMixin, BaseLiveServerTest):
|
||||
job = self.create_test_job(job_template=job_template)
|
||||
self.assertEqual(job.status, 'new')
|
||||
self.assertFalse(job.passwords_needed_to_start)
|
||||
self.assertTrue(job.start())
|
||||
self.assertTrue(job.signal_start())
|
||||
self.assertEqual(job.status, 'waiting')
|
||||
job = Job.objects.get(pk=job.pk)
|
||||
self.assertEqual(job.status, 'successful')
|
||||
|
||||
@ -911,7 +911,7 @@ class JobStartCancelTest(BaseJobTestMixin, django.test.LiveServerTestCase):
|
||||
def test_get_job_results(self):
|
||||
# Start/run a job and then access its results via the API.
|
||||
job = self.job_ops_east_run
|
||||
job.start()
|
||||
job.signal_start()
|
||||
|
||||
# Check that the job detail has been updated.
|
||||
url = reverse('api:job_detail', args=(job.pk,))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user