-
Task
-
Resolution: Done-Errata
-
Critical
-
None
-
False
-
False
-
-
3
-
1.4 GA
-
Testable
If convert2rhel is running more than once in parallel, the system may be put into an inconsistent state. We can prevent convert2rhel from doing this by implementing a lock file.
Acceptance Criteria
- On start, convert2rhel finds its own PID.
- create a temporary file in /run (or /var/run) that contains the PID
- attempt to os.rename() the temporary file to convert2rhel.pid
- if the rename fails because the file already exists, check for a stale file:
- check whether the pid in the file matches with a running process. If that is convert2rhel then we know that convert2rhel is already running.
- remove the temporary file
- output an error message
- exit.
- If the pid is not a running process or obviously not convert2rhel, then remove the pid file and go back to step 3.
- check whether the pid in the file matches with a running process. If that is convert2rhel then we know that convert2rhel is already running.
- if the rename fails for another reason, issue an unexpected error, remove the temporary file, and exit
- If the rename succeeds then we are now the only running version of convert2rhel.
- On convert2rhel exit, remove the convert2rhel.pid file.(Use a context manager to make sure the file is always removed on exit. https://docs.python.org/2.7/library/contextlib.html )
- is triggering
-
RHELC-1124 Clean up ApplicationLock's API to have a consistent model
- Backlog
- links to
-
RHEA-2023:120152 convert2rhel bug fix and enhancement update
-
RHEA-2023:120153 convert2rhel bug fix and enhancement update