X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plc-config-tty;h=d9559dcfef20320958f23dd57c451baa208dcd7a;hb=391310e122de0536c08f62bd46acd3b3b7b13964;hp=79f72333e37f6d350288113c31a65880a1a89e67;hpb=5beafd1fab624c36f81972588da3463a416a8a00;p=myplc.git diff --git a/plc-config-tty b/plc-config-tty index 79f7233..d9559dc 100755 --- a/plc-config-tty +++ b/plc-config-tty @@ -20,8 +20,8 @@ import getopt from plc_config import PLCConfiguration #################### -release_id = "$Id: plc-config-tty,v 1.10 2006/12/12 10:14:44 thierry Exp $" -release_rev = "$Revision: 1.10 $" +release_id = "$Id: plc-config-tty 635 2007-07-05 11:08:14Z thierry $" +release_rev = "$Revision: 635 $" def init_flavour (flavour): global service @@ -57,18 +57,18 @@ def init_flavour (flavour): global mainloop_usage mainloop_usage= """Available commands: Uppercase versions give variables comments, when available --u/U\t\t\tEdit usual variables --w\t\t\tWrite & consolidate --r\t\t\tRestart %s service --q\t\t\tQuit (without saving) --h/?\t\t\tThis help + u/U\t\t\tEdit usual variables + w\t\t\tWrite & consolidate + r\t\t\tRestart %s service + q\t\t\tQuit (without saving) + h/?\t\t\tThis help --- -l/L [|]\tShow Locally modified variables/values --s/S [|]\tShow variables/values (all, in category, single) --e/E [|]\tEdit variables (all, in category, single) + l/L [|]\tShow Locally modified variables/values + s/S [|]\tShow variables/values (all, in category, single) + e/E [|]\tEdit variables (all, in category, single) --- --c\t\t\tList categories --v/V [|]List Variables (all, in category, single) + c\t\t\tList categories + v/V [|]List Variables (all, in category, single) --- Typical usage involves: u, [l,] w, r, q """ % service @@ -182,6 +182,7 @@ def consolidate (default_config, site_config, consolidated_config): return print ("Merged\n\t%s\nand\t%s\ninto\t%s"%(default_config,site_config, consolidated_config)) + os.system("set -x ; service plc reload") #################### def restart_plc (): @@ -405,23 +406,16 @@ def mainloop (cdef, cread, cwrite, default_config, site_config, consolidated_con print ("Unknown command >%s< -- use h for help" % answer) #################### +# creates directory for file if not yet existing def check_dir (config_file): dirname = os.path.dirname (config_file) if (not os.path.exists (dirname)): - print "Config file %s located under a non-existing directory" % config_file - answer=raw_input("Want to create %s [y]/n ? " % dirname) - answer = answer.lower() - if (answer == 'n'): - print "Cannot proceed - good bye" + os.makedirs(dirname,0755) + if (not os.path.exists (dirname)): + print "Cannot create dir %s - exiting" % dirname sys.exit(1) else: - os.makedirs(dirname,0755) - if (not os.path.exists (dirname)): - print "Cannot create dir %s - exiting" % dirname - sys.exit(1) - else: - print "Created directory %s" % dirname - + print "Created directory %s" % dirname #################### def main ():