mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
Minor tweaks to ansible-runner cleanup task arguments
This commit is contained in:
parent
56ab1c2f0a
commit
85ec83c3fd
@ -186,12 +186,16 @@ class Instance(HasPolicyEditsMixin, BaseModel):
|
||||
returns a dict that is passed to the python interface for the runner method corresponding to that command
|
||||
any kwargs will override that key=value combination in the returned dict
|
||||
"""
|
||||
vargs = dict()
|
||||
vargs = dict(grace_period=60) # grace period of 60 minutes, need to set because CLI default will not take effect
|
||||
if settings.AWX_CLEANUP_PATHS:
|
||||
vargs['file_pattern'] = os.path.join(settings.AWX_ISOLATION_BASE_PATH, JOB_FOLDER_PREFIX % '*') + '*'
|
||||
vargs.update(kwargs)
|
||||
if 'exclude_strings' not in vargs and vargs.get('file_pattern'):
|
||||
active_pks = list(UnifiedJob.objects.filter(execution_node=self.hostname, status__in=('running', 'waiting')).values_list('pk', flat=True))
|
||||
active_pks = list(
|
||||
UnifiedJob.objects.filter(
|
||||
(models.Q(execution_node=self.hostname) | models.Q(controller_node=self.hostname)) & models.Q(status__in=('running', 'waiting'))
|
||||
).values_list('pk', flat=True)
|
||||
)
|
||||
if active_pks:
|
||||
vargs['exclude_strings'] = [JOB_FOLDER_PREFIX % job_id for job_id in active_pks]
|
||||
if 'remove_images' in vargs or 'image_prune' in vargs:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user