From 35394ebd0ec92fb21b32ad526557ef388726509b Mon Sep 17 00:00:00 2001 From: Claudio-Daniel Freire Date: Thu, 9 Jun 2011 15:05:45 +0200 Subject: [PATCH] Do check dependency install after the fact. Raise an exception if there was an error. --- src/nepi/testbeds/planetlab/node.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/nepi/testbeds/planetlab/node.py b/src/nepi/testbeds/planetlab/node.py index 65143725..8557a95e 100644 --- a/src/nepi/testbeds/planetlab/node.py +++ b/src/nepi/testbeds/planetlab/node.py @@ -272,7 +272,7 @@ class Node(object): # Start process in a "daemonized" way, using nohup and heavy # stdin/out redirection to avoid connection issues (out,err),proc = rspawn.remote_spawn( - "yum -y install %(packages)s" % { + "( yum -y install %(packages)s && echo SUCCESS || echo FAILURE )" % { 'packages' : ' '.join(self.required_packages), }, pidfile = pidfile, @@ -327,6 +327,26 @@ class Node(object): ): time.sleep(probe) probe = min(probemax, 1.5*probe) + + # check results + logfile = self.DEPENDS_LOGFILE + + (out,err),proc = server.popen_ssh_command( + "cat %s" % (server.shell_escape(logfile),), + host = self.hostname, + port = None, + user = self.slicename, + agent = None, + ident_key = self.ident_path, + server_key = self.server_key + ) + + if proc.wait(): + raise RuntimeError, "Failed to install dependencies: %s %s" % (out,err,) + + success = out.strip().rsplit('\n',1)[-1].strip() == 'SUCCESS' + if not success: + raise RuntimeError, "Failed to install dependencies - buildlog:\n%s\n%s" % (out,err,) def is_alive(self): # Make sure all the paths are created where -- 2.47.0