fix errors
authorTony Mack <tmack@cs.princeton.edu>
Tue, 8 Jan 2008 19:32:04 +0000 (19:32 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Tue, 8 Jan 2008 19:32:04 +0000 (19:32 +0000)
qaapi/qa/modules/plc/install.py

index 679ca28..37c0a72 100644 (file)
@@ -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)