Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check PID within the namespace #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion unit_tests/test_zaza_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ async def _run_on_unit(
self.async_run_on_unit.side_effect = _run_on_unit
self.assertEqual(
model.get_unit_service_start_time('app/2', 'mysvc1'), 1524409654)
cmd = "stat -c %Y /proc/$(pidof -x mysvc1 | cut -f1 -d ' ')"
cmd = "stat -c %Y /proc/$(pgrep mysvc1 --nslist pid --ns 1 | head -n1)"
self.async_run_on_unit.assert_called_once_with(
unit_name='app/2',
command=cmd,
Expand Down
3 changes: 2 additions & 1 deletion zaza/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ async def async_get_unit_service_start_time(unit_name, service,
:rtype: int
:raises: ServiceNotRunning
"""
cmd = "stat -c %Y /proc/$(pidof -x {} | cut -f1 -d ' ')".format(service)
cmd = ("stat -c %Y /proc/$(pgrep {} --nslist pid"
" --ns 1 | head -n1)").format(service)
out = await async_run_on_unit(
unit_name=unit_name,
command=cmd,
Expand Down