From 6d6aafc225625a894a2d4e468bb4985190d06d79 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 8 Jan 2008 19:32:04 +0000 Subject: [PATCH] fix errors --- qaapi/qa/modules/plc/install.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/qaapi/qa/modules/plc/install.py b/qaapi/qa/modules/plc/install.py index 679ca28..37c0a72 100644 --- a/qaapi/qa/modules/plc/install.py +++ b/qaapi/qa/modules/plc/install.py @@ -1,9 +1,9 @@ import os, sys import traceback +from qa import utils from qa.Test import Test - class install(Test): """ Installs a myplc @@ -11,23 +11,32 @@ class install(Test): def call(self, url=None): - # Determine url + url_path = self.config.path + # Determine url if not url: - url_file = open("%s/URL" % self.path) - url = url_file.read().strip() - url_file.close() - + try: + + print self.config.path + url_file = open("%s/URL" % url_path) + url = url_file.read().strip() + url_file.close() + except IOError: + pass + if not url: + print "URL not specified" + sys.exit(1) + # Save url if self.config.verbose: - utils.header('Saving current myplc url into %s/URL' % self.path) - fsave=open('%s/URL' % self.path, "w") + utils.header('Saving current myplc url into %s/URL' % url_path) + fsave=open('%s/URL' % url_path, "w") fsave.write(url+'\n') fsave.close() # Instal myplc from url if self.config.verbose: utils.header('Installing myplc from url %s' % url) - (stdin, stdout, stderr) = os.popen3('set -x; rpm -Uvh ' + self.url) + (stdin, stdout, stderr) = os.popen3('set -x; rpm -Uvh ' + url) self.errors = stderr.readlines() if self.errors: raise "\n".join(self.errors) -- 2.47.0