initial checkin of qa api
[tests.git] / qaapi / qa / modules / plc / install.py
1
2 import os, sys
3 import traceback
4 from qa.Test import Test
5
6
7 class install(Test):
8     """
9     Installs a myplc
10     """
11
12     def call(self, url=None):
13         
14         # Determine url 
15         if not url:
16             url_file = open("%s/URL" % self.path)
17             url = url_file.read().strip()
18             url_file.close()
19         
20         # Save url
21         if self.config.verbose:
22             utils.header('Saving current myplc url into %s/URL' % self.path)
23         fsave=open('%s/URL' % self.path, "w")
24         fsave.write(url+'\n')
25         fsave.close()
26         
27         # Instal myplc from url          
28         if self.config.verbose:
29             utils.header('Installing myplc from url %s' % url)
30         (stdin, stdout, stderr) = os.popen3('set -x; rpm -Uvh ' + self.url)
31         self.errors = stderr.readlines()
32         if self.errors: raise "\n".join(self.errors)    
33         
34         return 1