X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=plc-config-tty;h=1e45cdcbee50a7b22050127778eef84f6832411e;hb=c77f3870faf07bbab64757cb6b75a991260b795a;hp=d9559dcfef20320958f23dd57c451baa208dcd7a;hpb=391310e122de0536c08f62bd46acd3b3b7b13964;p=myplc.git diff --git a/plc-config-tty b/plc-config-tty index d9559dc..1e45cdc 100755 --- a/plc-config-tty +++ b/plc-config-tty @@ -18,10 +18,11 @@ import readline import getopt from plc_config import PLCConfiguration +from plc_config import ConfigurationException #################### -release_id = "$Id: plc-config-tty 635 2007-07-05 11:08:14Z thierry $" -release_rev = "$Revision: 635 $" +release_id = "$Id$" +release_rev = "$Revision$" def init_flavour (flavour): global service @@ -360,8 +361,14 @@ def mainloop (cdef, cread, cwrite, default_config, site_config, consolidated_con return elif (command in "wW"): try: + # Confirm that various constraints are met before saving file. + cwrite.verify(cdef, cread) cwrite.save(site_config) + except ConfigurationException, e: + print "Save failed due to a configuration exception: %s" % e + break; except: + import traceback; print traceback.print_exc() print ("Could not save -- fix write access on %s" % site_config) break print ("Wrote %s" % site_config)