Skip to content

Commit

Permalink
Change the default test pidfile directory to /var/tmp
Browse files Browse the repository at this point in the history
The original path, `/var/tmp/tmt`, may not always exist or may have
unexpected permissions, preventing the pidfile from being created when
less privileged account is used to access a guest.
  • Loading branch information
happz committed Oct 30, 2023
1 parent 9a6ed0d commit 2fbbdf4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tmt/steps/execute/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,22 @@
TEST_PIDFILE_FILENAME = 'tmt-test.pid'
TEST_PIDFILE_LOCK_FILENAME = f'{TEST_PIDFILE_FILENAME}.lock'

#: The default directory for storing test pid file.
TEST_PIDFILE_ROOT = Path('/var/tmp')


def effective_pidfile_root() -> Path:
"""
Find out what the actual pidfile directory is.
If ``TMT_TEST_PIDFILE_ROOT`` variable is set, it is used. Otherwise,
the effective workdir root is picked.
:py:const:`TEST_PIDFILE_ROOT` is picked.
"""

if 'TMT_TEST_PIDFILE_ROOT' in os.environ:
return Path(os.environ['TMT_TEST_PIDFILE_ROOT'])

return tmt.utils.effective_workdir_root()
return TEST_PIDFILE_ROOT


TEST_WRAPPER_FILENAME = 'tmt-test-wrapper.sh'
Expand Down

0 comments on commit 2fbbdf4

Please sign in to comment.