-
+#!/usr/bin/python
import os, sys
import traceback
from Test import 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',
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
+#!/usr/bin/python
import os, sys
import traceback
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()
# 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))
+#!/usr/bin/python
import os, sys
from Test import Test
from qa import utils
+#!/usr/bin/python
+
import traceback
import sys
from Test import 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))
+#!/usr/bin/python
+
import os, sys
import traceback
from Test import 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))
+#!/usr/bin/python
+
import os, sys
import traceback
from Test import 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))