Commit 642c4574 authored by Devaev Maxim's avatar Devaev Maxim

Log exceptions at file creating in PlainConfig

parent 2ed738ed
...@@ -50,6 +50,7 @@ class PlainEditor(object) : ...@@ -50,6 +50,7 @@ class PlainEditor(object) :
if not os.access(config_file_path, os.F_OK) : if not os.access(config_file_path, os.F_OK) :
logger.debug("{submod}: Config file \"%s\" does not exist" % (config_file_path)) logger.debug("{submod}: Config file \"%s\" does not exist" % (config_file_path))
try :
if sample_config_file_path != None and os.access(sample_config_file_path, os.F_OK) : if sample_config_file_path != None and os.access(sample_config_file_path, os.F_OK) :
shutil.copy2(sample_config_file_path, config_file_path) shutil.copy2(sample_config_file_path, config_file_path)
logger.debug("{submod}: Config file \"%s\" has been created from sample \"%s\"" % ( logger.debug("{submod}: Config file \"%s\" has been created from sample \"%s\"" % (
...@@ -57,6 +58,9 @@ class PlainEditor(object) : ...@@ -57,6 +58,9 @@ class PlainEditor(object) :
else : else :
open(config_file_path, "w").close() open(config_file_path, "w").close()
logger.debug("{submod}: Created empty file \"%s\"" % (config_file_path)) logger.debug("{submod}: Created empty file \"%s\"" % (config_file_path))
except :
logger.error("Cannot create config file \"%s\"" % (config_file_path))
logger.attachException()
config_file = open(config_file_path, "r") config_file = open(config_file_path, "r")
self.__config_file_data_list = config_file.read().split("\n") self.__config_file_data_list = config_file.read().split("\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment