Add wrapper driver execution context

We recently began altering the mount map used by the wrapper driver
for each execution run (so that we can only include the current
playbook).  However, the setMountsMap method operates on the global
driver object rather than an object more closely bound to the lifetime
of the playbook run.  The fact that this works at all is just luck
(executing process is slow enough that hitting a race condition where
the wrong directories are mounted is unlikely).

To correct this, add a new layer which contains the context for the
current playbook execution.

Change-Id: I3a06f19e88435a49c7b9aea4e1221b812f5a43d0
This commit is contained in:
James E. Blair
2017-08-18 14:39:06 -07:00
parent cb3fde2aa5
commit ce56ff9756
6 changed files with 105 additions and 53 deletions

View File

@@ -18,14 +18,19 @@ import logging
import subprocess
from zuul.driver import (Driver, WrapperInterface)
from zuul.execution_context import BaseExecutionContext
class NullExecutionContext(BaseExecutionContext):
log = logging.getLogger("zuul.NullExecutionContext")
def getPopen(self, **kwargs):
return subprocess.Popen
class NullwrapDriver(Driver, WrapperInterface):
name = 'nullwrap'
log = logging.getLogger("zuul.NullwrapDriver")
def getPopen(self, **kwargs):
return subprocess.Popen
def setMountsMap(self, **kwargs):
pass
def getExecutionContext(self, ro_paths=None, rw_paths=None):
return NullExecutionContext()