From ff48d5ea8f966d46c84403c114e06ba2a1970a5d Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Tue, 23 May 2017 11:13:46 -0400 Subject: [PATCH] Bump diskimage-builder dependency to 2.0.0 Recent version of diskimage-builder now include the virtualenv logic, so we can delete our copy. Change-Id: Ic2d99258b3bd3487e8f10c50bfa10f8215d66b14 Signed-off-by: Paul Belanger --- nodepool/builder.py | 28 ---------------------------- requirements.txt | 2 +- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/nodepool/builder.py b/nodepool/builder.py index 39111155f..f543dedb3 100644 --- a/nodepool/builder.py +++ b/nodepool/builder.py @@ -21,7 +21,6 @@ import subprocess import threading import time import shlex -import sys from nodepool import config as nodepool_config from nodepool import exceptions @@ -513,32 +512,6 @@ class BuildWorker(BaseWorker): self.name = 'BuildWorker.%s' % name self.dib_cmd = dib_cmd - def _running_under_virtualenv(self): - # NOTE: borrowed from pip:locations.py - if hasattr(sys, 'real_prefix'): - return True - elif sys.prefix != getattr(sys, "base_prefix", sys.prefix): - return True - return False - - def _activate_virtualenv(self): - """Run as a pre-exec function to activate current virtualenv - - If we are invoked directly as /path/ENV/nodepool-builer (as - done by an init script, for example) then /path/ENV/bin will - not be in our $PATH, meaning we can't find disk-image-create. - Apart from that, dib also needs to run in an activated - virtualenv so it can find utils like dib-run-parts. Run this - before exec of dib to ensure the current virtualenv (if any) - is activated. - """ - if self._running_under_virtualenv(): - activate_this = os.path.join(sys.prefix, "bin", "activate_this.py") - if not os.path.exists(activate_this): - raise exceptions.BuilderError("Running in a virtualenv, but " - "cannot find: %s" % activate_this) - execfile(activate_this, dict(__file__=activate_this)) - def _checkForScheduledImageUpdates(self): ''' Check every DIB image to see if it has aged out and needs rebuilt. @@ -712,7 +685,6 @@ class BuildWorker(BaseWorker): shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - preexec_fn=self._activate_virtualenv, env=env) except OSError as e: raise exceptions.BuilderError( diff --git a/requirements.txt b/requirements.txt index 865b01ae7..2c4b82b6d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ PrettyTable>=0.6,<0.8 six>=1.7.0 os-client-config>=1.2.0 shade>=1.18.1 -diskimage-builder>=1.21.0 +diskimage-builder>=2.0.0 voluptuous kazoo Paste