def configured_filesystem(self, job): """ Context manager for handling filesystem aspects of job execution. :param job: The JobDefinition to execute :returns: Pathname of the executable symlink nest directory. """ # Create a nest for all the private executables needed for execution prefix = 'nest-' suffix = '.{}'.format(job.checksum) with tempfile.TemporaryDirectory(suffix, prefix) as nest_dir: os.chmod(nest_dir, 0o777) logger.debug(_("Symlink nest for executables: %s"), nest_dir) from plainbox.impl.ctrl import SymLinkNest nest = SymLinkNest(nest_dir) # Add all providers sharing namespace with the current job to PATH for provider in self._provider_list: if job.provider.namespace == provider.namespace: nest.add_provider(provider) yield nest_dir
def setUp(self): self.nest = SymLinkNest(self.NEST_DIR)