Ansible launcher: use sequence-uuid in shell scripts

For the generated shell scripts which are named using UUID4, prepend a
sequence count to them to easily be able to tell the ordering of the
scripts when looking in '_zuul_ansible/scripts/'.  Keep the uuid to
avoid potential collisions in /tmp.

Change-Id: Id80bf5139ba1ce12c62945421d49c5e3cd8e2f48
This commit is contained in:
John L. Villalovos 2016-10-12 11:46:44 -07:00 committed by James E. Blair
parent 3f21d4061d
commit 5a84a7647e
1 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import tempfile
import threading
import time
import traceback
import uuid
import Queue
import gear
@ -1269,7 +1270,7 @@ class NodeWorker(object):
def _makeBuilderTask(self, jobdir, builder, parameters, sequence):
tasks = []
script_fn = '%02d.sh' % sequence
script_fn = '%02d-%s.sh' % (sequence, str(uuid.uuid4().hex))
script_path = os.path.join(jobdir.script_root, script_fn)
with open(script_path, 'w') as script:
data = builder['shell']