Closed angusjfw closed 1 year ago
Base: 57.76% // Head: 57.29% // Decreases project coverage by -0.46%
:warning:
Coverage data is based on head (
4e5e30d
) compared to base (838874e
). Patch coverage: 0.00% of modified lines in pull request are covered.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
I think we should probably move the get_*
functions into the pitop.common.current_session_info
file.
Also, should our pitop.command_runner.run
function use the user environment from this PR?
I think we should probably move the
get_*
functions into thepitop.common.current_session_info
file.
Even though these functions resemble some in there, like get_current_user, they are actually not related to a 'current session' - you have to provide a user argument and they provide fairly static information about the system users. They could have a more common/generic use than being internals of 'switch_user.py', but I'd personally suggest leaving them there until this use case emerges. They're mostly thin wrappers on the pwd module anyway. Maybe I should prefix them an underscore or two?
Also, should our
pitop.command_runner.run
function use the user environment from this PR
That isn't necessary unless we want to use command_runner as a different user, in which case we could add a param or separate method to command_runner and make use of these. The intention is that you could use env_for_user
alongisde other use-case-specific environment changes like we have in command_runner. So if we did it might look like:
def run_command_background(command_str: str, print_output=False, user=None) -> Popen:
if user is not None:
return Popen(
split(command_str),
env=env_for_user(user, __get_env()), # combining the switch_user env with command_runner's get_env-
preexec_fn=lambda: switch_user(user)
...
Main changes
Screenshots (feature, test output, profiling, dev tools etc)
[insert screenshots here]
Other notes (e.g. implementation quirks, edge cases, questions / issues)
Manual testing tips
-
Tag anyone who definitely needs to review or help
-