should_use_passwordless_sudo

Function should_use_passwordless_sudo 

Source
pub fn should_use_passwordless_sudo(settings: &Settings) -> bool
Expand description

What: Check if passwordless sudo should be used based on settings and system availability.

Inputs:

  • settings: Reference to the application settings.

Output:

  • true if passwordless sudo should be used, false otherwise.

Details:

  • First checks if use_passwordless_sudo is enabled in settings (safety barrier).
  • If not enabled, returns false immediately without checking system availability.
  • If enabled, checks if passwordless sudo is actually available on the system.
  • Returns true only if both conditions are met.
  • Logs the decision for debugging purposes.
  • Testing: Only when PACSEA_INTEGRATION_TEST=1 is set (test harness), the env var PACSEA_TEST_SUDO_PASSWORDLESS is honored. In production this override is disabled.