-
- if serial is None:
- # There must be a serious problem
- raise errors.JobQueueError("Can't read/parse the job queue serial file")
+ if serial is None:
+ # Write new serial file
+ utils.WriteFile(constants.JOB_QUEUE_SERIAL_FILE,
+ data="%s\n" % 0)
+
+ # Read again
+ serial = ReadSerial()
+
+ if serial is None:
+ # There must be a serious problem
+ raise errors.JobQueueError("Can't read/parse the job queue"
+ " serial file")
+
+ if not must_lock:
+ # There's no need for more error handling. Closing the lock
+ # file below in case of an error will unlock it anyway.
+ queue_lock.Unlock()