no _ignore in steps, apparently
[tests.git] / qaapi / qa / tests / plc_configure.py
index 381179a..6e4e177 100644 (file)
@@ -11,33 +11,27 @@ class plc_configure(Test):
     Configure the myplc from config options in config file
     """
 
-    def call(self, plc_name, plc_config_option=None, plc_config_value=None):
+    def call(self, plc_name, plc_config_options = None):
        
        # Get plc configuration from config
-        plc = PLC(self.config)
-        plcs = getattr(self.config, 'plcs', [])
-        for p in plcs:
-            if p['name'] in [plc_name]:
-                plc.update(p)
-
+       plc = self.config.get_plc(plc_name)
        services = ['API', 'DB', 'WWW', 'BOOT']
        plc_options = [] 
         
        # Turn off plc (for good measure)
        command = "/sbin/service plc stop"
-       if self.config.verbose: utils.header(command)
+       if self.config.verbose: utils.header(command, logfile = self.config.logfile)
         (status, output) = plc.commands(command)
 
-       # mount plc (need to do this optionally, as we do not want this for myplc-native)
+       # mount plc 
        command = "/sbin/service plc mount"
-       if self.config.verbose: utils.header(command)
+       if self.config.verbose: utils.header(command, logfile = self.config.logfile)
         (status, output) = plc.commands(command)
 
        # Get plc configuration variables
-       if plc_config_option is not None and \
-          plc_config_value  is not None:
-           # Set option passed in from user
-           plc_options.append((plc_config_option, plc_config_value))
+       if plc_config_options is not None:
+           for (option, value) in plc_config_options.items():
+               plc_options.append((option, value))
        else:
            # Use hostname and ip of host we are running on
            for service in services:
@@ -53,28 +47,28 @@ class plc_configure(Test):
        # Write temporary plc-config file
        # XX use plc instance to copy file
         tmpfconf, tmpfname = tempfile.mkstemp(".config","plc-config-tty", '/usr/tmp/')
-       tmpfname_parts = tempfname.split(os.sep)
+       tmpfname_parts = tmpfname.split(os.sep)
        if self.config.verbose:
-            utils.header("generating temporary config file %(tmpfname)s"%locals())
+            utils.header("generating temporary config file %(tmpfname)s"%locals(), logfile = self.config.logfile)
        for (option, value) in plc_options:
             os.write(tmpfconf, 'e %s\n%s\n' % (option, value))
         os.write(tmpfconf,'w\nq\n')
        os.close(tmpfconf)
-       plc.scp(tmpfname, "%s:/usr/tmp" % (plc['host']))
+       #plc.scp(tmpfname, "%s:/usr/tmp" % (plc['host']))
 
         # configure plc
        command = "plc-config-tty < %(tmpfname)s" % locals()
-       if self.config.verbose: utils.header(command)
+       if self.config.verbose: utils.header(command, logfile = self.config.logfile)
         (status, output) = plc.commands(command)
 
        # clean up temporary conf file
        # XX use plc instance to copy file
-       if self.config.verbose: utils.header("removing %(tmpfname)s"%locals())
+       if self.config.verbose: utils.header("removing %(tmpfname)s"%locals(), logfile = self.config.logfile)
         os.unlink(tmpfname)
 
        # umount plc (need to do this optionally, as we do not want this for myplc-native)
        command = "/sbin/service plc umount"
-       if self.config.verbose: utils.header(command)
+       if self.config.verbose: utils.header(command, logfile = self.config.logfile)
         (status, output) = plc.commands(command)
 
        return 1