lorax/src/pylorax
Brian C. Lane 6a55184c66 lorax: Move default tmp dir to /var/tmp/lorax
If systemd's tmpfiles.d timer is executed while lorax is running it will
remove any files and directories older than 30 days. This is what has
been causing the occasional error where /proc/ would seem to vanish
during the install.

Upstream has proposed this solution, https://github.com/systemd/systemd/pull/11482
but until that is released we need a work-around to protect the lorax
files.

This commit does several things:

* Move the default tmpdir from /var/tmp/ to /var/tmp/lorax/
* Add a lorax.conf tmpfiles.d file that prevents systemd-tmpfiles from
  removing anything under /var/tmp/lorax/
* Add an exit handler to lorax so that temporary directories are removed on
  exit or on a python traceback.
* Use flock to lock access to the tempdir while lorax is running.
* Remove any unlocked tempdirs named /var/tmp/lorax/lorax.* at startup

Note that the exit handler will not remove the tempdir if lorax is
killed with a signal -- those are being caught by dnf and prevent the
exit handler from running.

systemd-tmpfiles cannot clean up the tempdirs at boot time because they
contain files labeled as shadow_t, so we have to remove those when lorax
runs. It uses the flock to prevent removing any directories created by
parallel instances of lorax and only removes ones that are unlocked.
Worst case they will be around until the first run of lorax after a
reboot.

If you want to keep the working directory around for debugging purposes
use --workdir /var/tmp/lorax/my-workdir and it won't be removed by
lorax.

Resolves: rhbz#1668408
2019-01-30 09:19:24 -08:00
..
api Report an error if the blueprint doesn't exist 2019-01-11 14:37:01 -08:00
__init__.py Remove SELinux Permissive checks 2018-11-29 13:05:01 -08:00
base.py Fix DataHolder to handle hasattr 2016-05-04 10:34:02 -07:00
buildstamp.py Write the --variant string to .buildstamp as 'Variant=' 2018-01-17 09:38:16 -08:00
cmdline.py lorax: Move default tmp dir to /var/tmp/lorax 2019-01-30 09:19:24 -08:00
creator.py Make sure cancel_func is not None 2019-01-07 14:10:11 -08:00
decorators.py Convert pylorax to python3 2015-05-15 17:11:20 -07:00
discinfo.py Convert pylorax to python3 2015-05-15 17:11:20 -07:00
dnfhelper.py Disable pylint no-member errors for 2 dnf constants 2019-01-11 14:37:01 -08:00
executils.py pylorax: proc.returncode can be None 2016-03-09 16:41:11 -08:00
imgutils.py lorax: Save information about rootfs filesystem size and usage 2018-12-18 08:49:39 -08:00
installer.py Revert "lorax-composer: Cancel running Anaconda process" 2019-01-08 14:47:25 -08:00
ltmpl.py templates: Stop using gconfset 2018-05-24 09:13:05 -07:00
monitor.py livemedia-creator: Check for packaging failures in the logs (#1374809) 2016-09-21 09:00:49 -07:00
mount.py Add ppc64le kernel path 2016-09-08 12:12:07 -07:00
output.py Convert pylorax to python3 2015-05-15 17:11:20 -07:00
sysutils.py Ignore a pylint warning about UnquotingConfigParser get args 2018-09-04 11:13:20 -07:00
treebuilder.py lorax: Only run depmod on the installed kernels 2018-09-25 09:17:01 -07:00
treeinfo.py Additional python3 changes 2015-05-15 17:11:20 -07:00