fix files error handling

This commit is contained in:
Konstantin Stepanov 2014-04-23 20:05:22 +03:00
parent 1b01905327
commit 9a38695777

View File

@ -21,7 +21,7 @@ SELF = os.path.basename(sys.argv[0])
try:
os.makedirs(TIMERS_DIR)
except IOError as e:
except OSError as e:
if e.errno != os.errno.EEXIST:
raise
@ -185,7 +185,11 @@ AccuracySec=%sm
%s
''' % (SELF, job['f'], job['l'], unit_name, accuracy, schedule))
os.symlink('%s/%s.timer' % (TARGER_DIR, unit_name), '%s/%s.timer' % (TIMERS_DIR, unit_name))
try:
os.symlink('%s/%s.timer' % (TARGER_DIR, unit_name), '%s/%s.timer' % (TIMERS_DIR, unit_name))
except OSError as e:
if e.errno != os.errno.EEXIST:
raise
with open('%s/%s.service' % (TARGER_DIR, unit_name), 'w') as f:
f.write('''# Automatically generated by %s