[hca] Join threads before closing file descriptor
In some environments, heat container agent is erroring because of file descriptor closing before threads have joined. Change-Id: I1de5042ea5f4229518e96b985b1832dcacb052db Story: 2007264 Task: 39788
This commit is contained in:
parent
81d0699c4c
commit
2e1811861b
@ -87,9 +87,14 @@ def main(argv=sys.argv):
|
|||||||
logger = dict(stdout=lambda line: log.info(line),
|
logger = dict(stdout=lambda line: log.info(line),
|
||||||
stderr=lambda line: log.debug(line))
|
stderr=lambda line: log.debug(line))
|
||||||
with open(lp, 'w') as fd:
|
with open(lp, 'w') as fd:
|
||||||
for label in ['stdout', 'stderr']:
|
threads = []
|
||||||
threading.Thread(target=consumer, args=[label, fd]).start()
|
for lb in ['stdout', 'stderr']:
|
||||||
|
t = threading.Thread(target=consumer, args=[lb, fd])
|
||||||
|
threads.append(t)
|
||||||
|
t.start()
|
||||||
deploy_status_code = subproc.wait()
|
deploy_status_code = subproc.wait()
|
||||||
|
for t in threads:
|
||||||
|
t.join()
|
||||||
|
|
||||||
if deploy_status_code:
|
if deploy_status_code:
|
||||||
log.error("Error running %s. [%s]\n" % (fn, deploy_status_code))
|
log.error("Error running %s. [%s]\n" % (fn, deploy_status_code))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user