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