From: Thierry Parmentelat Date: Sun, 17 Aug 2008 22:58:19 +0000 (+0000) Subject: verify phase fixed and re-enabled X-Git-Tag: MyPLC-4.3-1~7 X-Git-Url: http://git.onelab.eu/?p=myplc.git;a=commitdiff_plain;h=fe1a9fb55e1809875226b99bb84a6596ce761f6a verify phase fixed and re-enabled --- diff --git a/plc-config-tty b/plc-config-tty index e6596a7..1e45cdc 100755 --- a/plc-config-tty +++ b/plc-config-tty @@ -362,9 +362,7 @@ def mainloop (cdef, cread, cwrite, default_config, site_config, consolidated_con elif (command in "wW"): try: # Confirm that various constraints are met before saving file. - # xxx -- thierry -- this is preventing tests from running - # please re-enable when fixed - # cwrite.verify(cdef, cread) + cwrite.verify(cdef, cread) cwrite.save(site_config) except ConfigurationException, e: print "Save failed due to a configuration exception: %s" % e diff --git a/plc_config.py b/plc_config.py index bbc2f51..b40918c 100644 --- a/plc_config.py +++ b/plc_config.py @@ -254,20 +254,24 @@ class PLCConfiguration: """ - maint_user = self.get('plc_api', 'maintenance_user') - if maint_user == (None, None): - maint_user = read.get('plc_api', 'maintenance_user') - if maint_user == (None, None): - maint_user = default.get('plc_api', 'maintenance_user') - - root_user = self.get('plc', 'root_user') - if root_user == (None, None): - root_user = read.get('plc', 'root_user') - if root_user == (None, None): - root_user = default.get('plc', 'root_user') - - muser= maint_user[1]['value'] - ruser= root_user[1]['value'] + (category,maint_user) = self.get('plc_api', 'maintenance_user') + if maint_user == None: + (category, maint_user) = read.get('plc_api', 'maintenance_user') + if maint_user == None: + (category,maint_user) = default.get('plc_api', 'maintenance_user') + if maint_user == None: + raise ConfigurationException("Cannot find PLC_API_MAINTENANCE_USER") + + (category,root_user) = self.get('plc', 'root_user') + if root_user == None: + (category,root_user) = read.get('plc', 'root_user') + if root_user == None: + root_user = default.get('plc', 'root_user') + if root_user == None: + raise ConfigurationException("Cannot find PLC_ROOT_USER") + + muser= maint_user['value'] + ruser= root_user['value'] if muser == ruser: raise ConfigurationException("The Maintenance Account email address cannot be the same as the Root User email address")