Skip to content

Commit

Permalink
Makes the pidfile accessible by everyone
Browse files Browse the repository at this point in the history
Creates the pidfile at an accessible location
for every user, this way the manage pidfile
warning is avoided.

Signed-off-by: mcasquer <[email protected]>
  • Loading branch information
mcasquer committed Oct 22, 2024
1 parent c05919d commit d2dafc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tmt/steps/execute/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
TEST_PIDFILE_LOCK_FILENAME = f'{TEST_PIDFILE_FILENAME}.lock'

#: The default directory for storing test pid file.
TEST_PIDFILE_ROOT = Path('/var/tmp') # noqa: S108 insecure usage of temporary dir
TEST_PIDFILE_ROOT = Path('/var/tmp/pid') # noqa: S108 insecure usage of temporary dir


def effective_pidfile_root() -> Path:
Expand Down
4 changes: 4 additions & 0 deletions tmt/steps/provision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from tmt.package_managers import FileSystemPath, Package, PackageManagerClass
from tmt.plugins import PluginRegistry
from tmt.steps import Action, ActionTask, PhaseQueue
from tmt.steps.execute.internal import effective_pidfile_root
from tmt.utils import (
Command,
OnProcessStartCallback,
Expand Down Expand Up @@ -912,6 +913,9 @@ def setup(self) -> None:
Setup the guest after it has been started. It is called after :py:meth:`Guest.start`.
"""
pid_directory = effective_pidfile_root()
self.execute(ShellScript(f"mkdir -p {pid_directory}"))
self.execute(ShellScript(f"chmod ugo+rwx {pid_directory}"))

# A couple of requiremens for this field:
#
Expand Down

0 comments on commit d2dafc9

Please sign in to comment.