Skip to content

Commit

Permalink
Delete artifact dir after transmit phase is finished
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Jan 18, 2022
1 parent 8fac1c1 commit 2609ee5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions awx/main/tasks/receptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import concurrent.futures
from enum import Enum
import logging
import os
import shutil
import socket
import sys
import threading
Expand Down Expand Up @@ -330,6 +332,12 @@ def _run_internal(self, receptor_ctl):

transmitter_thread.join()

# Artifacts are an output, but sometimes they are an input as well
# this is the case with fact cache, where clearing facts deletes a file, and this must be captured
artifact_dir = os.path.join(self.runner_params['private_data_dir'], 'artifacts')
if os.path.exists(artifact_dir):
shutil.rmtree(artifact_dir)

resultsock, resultfile = receptor_ctl.get_work_results(self.unit_id, return_socket=True, return_sockfile=True)
# Both "processor" and "cancel_watcher" are spawned in separate threads.
# We wait for the first one to return. If cancel_watcher returns first,
Expand Down

0 comments on commit 2609ee5

Please sign in to comment.