removed call parameters. no longer need to provide system type.
authorTony Mack <tmack@cs.princeton.edu>
Fri, 25 Jan 2008 19:48:51 +0000 (19:48 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Fri, 25 Jan 2008 19:48:51 +0000 (19:48 +0000)
qaapi/qa/tests/plc_configure.py
qaapi/qa/tests/plc_install.py
qaapi/qa/tests/plc_remote_call.py
qaapi/qa/tests/plc_start.py
qaapi/qa/tests/plc_stop.py
qaapi/qa/tests/plc_uninstall.py

index 4cc1395..6a892ce 100644 (file)
@@ -1,4 +1,4 @@
-
+#!/usr/bin/python
 import os, sys
 import traceback
 from Test import Test
@@ -9,7 +9,7 @@ class plc_configure(Test):
     Configure the myplc from config options in config file
     """
 
-    def call(self, system_type, root_dir):
+    def call(self):
        tmpname = '/tmp/plc-cinfig-tty-%d' % os.getpid()
        fileconf = open(tmpname, 'w')
        for var in [ 'PLC_NAME',
@@ -27,21 +27,10 @@ class plc_configure(Test):
        fileconf.write('w\nq\n')
        fileconf.close()
 
-       mount_command = "/sbin/service plc mount"
-       full_command = ""
-       if system_type in ['vserv', 'vserver']:
-           full_command += " vserver %(root_dir)s exec " % locals()
-       elif system_type in ['chroot']:
-           full_command += " chroot %(root_dir)s " % locals()
-       else:
-           raise Exception, "Invalid system type %(sytem_type)s" % locals()
-
-       full_command += " plc-config-tty < %(tmpname)s" % locals()
-       commands = [mount_command, full_command]
-       for command in commands:
-           if self.config.verbose:
-               utils.header(command)           
-            (stdout, stderr) = utils.popen(command)
+       command = "/sbin/service plc mount && plc-config-tty < %(tmpname)s" % locals()
+       if self.config.verbose:
+           utils.header(command)               
+        (stdout, stderr) = utils.popen(command)
         (stdout, stderr) = utils.popen("rm %s" % tmpname)
 
        return 1
index caf0336..2f5642d 100644 (file)
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 
 import os, sys
 import traceback
@@ -9,13 +10,12 @@ class plc_install(Test):
     Installs a myplc
     """
 
-    def call(self, system_type, root_dir, url=None):
+    def call(self, url=None):
        
        url_path = self.config.path
        # Determine url
        if not url:
            try:
-
                url_file = open("%s/URL" % url_path)
                url = url_file.read().strip()
                url_file.close()
@@ -34,21 +34,24 @@ class plc_install(Test):
        
        # Instal myplc from url          
        if self.config.verbose:
-           utils.header('Installing myplc from url %s' % url)
+           utils.header('Downloading myplc from url %s' % url)
+
+       url_parts = url.split(os.sep)
+       rpm_file = url[-1:]
+       download_cmd = "wget %(url)s /tmp/%(rpm_file)s" % locals()
 
        # build command
-       full_command = ""
-       install_command = " rpm -Uvh %(url)s "
-       if system_type in ['vserv', 'vserver']:
-           full_command += " vserver %(root_dir)s exec "
-       elif system_type in ['chroot']:
-           pass
-       else:
-           raise Exception, "Invalid system type %(system_type)s" % locals() 
-
-       full_command += install_command % locals()
-        try: (stdout, stderr) = utils.popen(full_command)
-       except: (stdout, stderr) = utils.popen("yum localupdate %(url)s")
+       rpm_install = "rpm -Uvh /tmp/%(rpm_file)s" % locals()
+       yum_install = "yum -y localinstall /tmp/%(rpm_file)s" % locals()
+
+       if self.config.verbose:
+           utils.header("Trying: %(rpm_install)s" % locals())
+        try: 
+           (stdout, stderr) = utils.popen(rpm_install)
+       except:
+           if self.config.verbose:
+               utils.header("Trying %(yum_install)s" % locals()) 
+           (stdout, stderr) = utils.popen(yum_install)
 
        if self.config.verbose:
            utils.header("\n".join(stdout))
index f6fe3af..743c31f 100644 (file)
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 import os, sys
 from Test import Test
 from qa import utils
index a55e7e7..9ad9b66 100644 (file)
@@ -1,3 +1,5 @@
+#!/usr/bin/python
+
 import traceback
 import sys
 from Test import Test
@@ -8,24 +10,14 @@ class plc_start(Test):
     Starts the myplc service
     """
 
-    def call(self, system_type, root_dir):
-       
-       start_command = " /sbin/service plc start "
-       full_command = ""
-
-       if system_type in ['vserv', 'vserver']:
-           full_command += " vserver %(root_dir)s exec "
-       elif system_type in ['chroot']:
-           pass
-       else:
-           raise Exception, "Invalid system type %(system_type)s" % locals()
+    def call(self):
        
-       full_command += start_command % locals()
+       command = " /sbin/service plc start "
 
        if self.config.verbose:
-           utils.header(full_command)  
+           utils.header(command)       
 
-       (stdout, stderr) = utils.popen(full_command)
+       (stdout, stderr) = utils.popen(command)
        
        if self.config.verbose:
             utils.header("".join(stdout))
index a3b7a2f..58f20bf 100644 (file)
@@ -1,3 +1,5 @@
+#!/usr/bin/python
+
 import os, sys
 import traceback
 from Test import Test
@@ -8,23 +10,14 @@ class plc_stop(Test):
     Installs a myplc
     """
 
-    def call(self, system_type, root_dir):
+    def call(self):
         
-       stop_command = " /sbin/service plc stop "
-       full_command = ""
-       if system_type in ['vserv', 'vserver']:
-           full_command += " vserver %(root_dir)s exec "
-       elif system_type in ['chroot']:
-           pass
-       else:
-           raise Exception, "Invalid system type %(system_type)s" % locals()   
-       
-       full_command += stop_command % locals()
+       command = " /sbin/service plc stop "
 
        if self.config.verbose:
-           utils.header(full_command)
+           utils.header(command)
        
-       (stdout, stderr) = utils.popen(full_command)
+       (stdout, stderr) = utils.popen(command)
 
        if self.config.verbose:
            utils.header("\n".join(stdout))
index b623937..6860d9e 100644 (file)
@@ -1,3 +1,5 @@
+#!/usr/bin/python
+
 import os, sys
 import traceback
 from Test import Test
@@ -8,31 +10,20 @@ class plc_uninstall(Test):
     Completely removes the installed myplc
     """
 
-    def call(self, system_type, root_dir):
+    def call(self, remove_all = False):
        
-       remove_command = " rpm -e myplc " 
-       full_command = ""
+       command = "/sbin/service plc safestop; rpm -e myplc " 
+       if remove_all:
+           command += " && rm -rf /plc/data" 
 
-       if system_type in ['vserv', 'vserver']:
-           full_command += " vserver %(root_dir)s exec "
-       elif system_type in ['chroot']:
-           pass
-       else: 
-           raise Exception, "Invalid system type %(system_type)s" % locals()
-        
        if self.config.verbose:
             utils.header("Removing myplc")
 
-       full_command = full_command % locals()
-       (stdout, stderr) = utils.popen(full_command + "/sbin/service plc safestop")
+       (stdout, stderr) = utils.popen(command)
        if self.config.verbose:
            utils.header("\n".join(stdout))
                
-        (stdout, stderr) = utils.popen(full_command + remove_command)
-        if self.config.verbose:
-           utils.header("\n".join(stdout))
-
-       (stdout, stderr) = utils.popen(full_command + " rm -rf  /plc/data")
+       (stdout, stderr) = utils.popen(command)
        if self.config.verbose:
            utiils.header("\n".join(stdout))