7 class plc_configure(Test):
9 Configure the myplc from config options in config file
14 # Get plc configuration variables
16 for attr in dir(self.config):
17 if attr.startswith('PLC'):
20 # Write temporary plc-config file
21 tmpname = '/tmp/plc-config-tty-%d' % os.getpid()
22 fileconf = open(tmpname, 'w')
24 fileconf.write('e %s\n%s\n' % (var, getattr(self.config, var)))
25 fileconf.write('w\nq\n')
29 command = "/sbin/service plc mount && plc-config-tty < %(tmpname)s" % locals()
30 if self.config.verbose:
32 (stdout, stderr) = utils.popen(command)
33 (stdout, stderr) = utils.popen("rm %s" % tmpname)
37 if __name__ == '__main__':
38 args = tuple(sys.argv[1:])
39 plc_configure()(*args)