mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -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:
@@ -708,7 +708,7 @@ class InventorySource(PrimordialModel):
|
|||||||
def update(self, **kwargs):
|
def update(self, **kwargs):
|
||||||
if self.can_update:
|
if self.can_update:
|
||||||
inventory_update = self.inventory_updates.create()
|
inventory_update = self.inventory_updates.create()
|
||||||
inventory_update.signal_start()
|
inventory_update.signal_start(**kwargs)
|
||||||
return inventory_update
|
return inventory_update
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
@@ -764,6 +764,11 @@ class InventoryUpdate(CommonTask):
|
|||||||
return 50
|
return 50
|
||||||
|
|
||||||
def signal_start(self, **kwargs):
|
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_context = zmq.Context()
|
||||||
signal_socket = signal_context.socket(zmq.REQ)
|
signal_socket = signal_context.socket(zmq.REQ)
|
||||||
signal_socket.connect(settings.TASK_COMMAND_PORT)
|
signal_socket.connect(settings.TASK_COMMAND_PORT)
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class Project(CommonModel):
|
|||||||
def update(self, **kwargs):
|
def update(self, **kwargs):
|
||||||
if self.can_update:
|
if self.can_update:
|
||||||
project_update = self.project_updates.create()
|
project_update = self.project_updates.create()
|
||||||
project_update.signal_start()
|
project_update.signal_start(**kwargs)
|
||||||
return project_update
|
return project_update
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
@@ -376,6 +376,11 @@ class ProjectUpdate(CommonTask):
|
|||||||
return 20
|
return 20
|
||||||
|
|
||||||
def signal_start(self, **kwargs):
|
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_context = zmq.Context()
|
||||||
signal_socket = signal_context.socket(zmq.REQ)
|
signal_socket = signal_context.socket(zmq.REQ)
|
||||||
signal_socket.connect(settings.TASK_COMMAND_PORT)
|
signal_socket.connect(settings.TASK_COMMAND_PORT)
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ class CleanupJobsTest(BaseCommandMixin, BaseLiveServerTest):
|
|||||||
job = self.create_test_job(job_template=job_template)
|
job = self.create_test_job(job_template=job_template)
|
||||||
self.assertEqual(job.status, 'new')
|
self.assertEqual(job.status, 'new')
|
||||||
self.assertFalse(job.passwords_needed_to_start)
|
self.assertFalse(job.passwords_needed_to_start)
|
||||||
self.assertTrue(job.start())
|
self.assertTrue(job.signal_start())
|
||||||
self.assertEqual(job.status, 'waiting')
|
self.assertEqual(job.status, 'waiting')
|
||||||
job = Job.objects.get(pk=job.pk)
|
job = Job.objects.get(pk=job.pk)
|
||||||
self.assertEqual(job.status, 'successful')
|
self.assertEqual(job.status, 'successful')
|
||||||
|
|||||||
@@ -911,7 +911,7 @@ class JobStartCancelTest(BaseJobTestMixin, django.test.LiveServerTestCase):
|
|||||||
def test_get_job_results(self):
|
def test_get_job_results(self):
|
||||||
# Start/run a job and then access its results via the API.
|
# Start/run a job and then access its results via the API.
|
||||||
job = self.job_ops_east_run
|
job = self.job_ops_east_run
|
||||||
job.start()
|
job.signal_start()
|
||||||
|
|
||||||
# Check that the job detail has been updated.
|
# Check that the job detail has been updated.
|
||||||
url = reverse('api:job_detail', args=(job.pk,))
|
url = reverse('api:job_detail', args=(job.pk,))
|
||||||
|
|||||||
Reference in New Issue
Block a user