7 from qa.PLCs import PLC, PLCs
9 class plc_install(Test):
14 def call(self, plc_name, url=None):
17 plc = self.config.get_plc(plc_name)
18 url_path = self.config.path
23 url_file = open("%s/URL" % url_path)
24 url = url_file.read().strip()
29 print "URL not specified"
33 if self.config.verbose:
34 utils.header('Saving current myplc url into %s/URL' % url_path)
35 fsave=open('%s/URL' % url_path, "w")
39 # Instal myplc from url
40 if self.config.verbose:
41 utils.header('Downloading myplc from url %s' % url)
44 url_parts = url.split(os.sep)
46 download_cmd = "wget %(url)s /tmp/%(rpm_file)s" % locals()
47 rpm_install = "rpm -Uvh /tmp/%(rpm_file)s" % locals()
48 yum_install = "yum -y localinstall /tmp/%(rpm_file)s" % locals()
50 if self.config.verbose:
51 utils.header("Trying: %(rpm_install)s" % locals())
53 (status, output) = plc.commands(rpm_install)
55 if self.config.verbose:
56 utils.header("Trying %(yum_install)s" % locals())
57 (status, output) = plc.commands(download_cmd)
58 (status, output) = plc.commands(yum_install)
62 if __name__ == '__main__':
63 args = tuple(sys.argv[1:])