OPSI.Util.Task.Sudoers module

opsi python library - Util - Task - Sudoers

Functionality to patch a sudoers file on a Linux system.

New in version 4.0.4.3.

Changed in version 4.0.6.3: The path to service is received directly from the OS.

Changed in version 4.0.6.6: Avoid duplicating settings.

author:Niko Wenselowski <n.wenselowski@uib.de>
license:GNU Affero General Public License version 3
OPSI.Util.Task.Sudoers.distributionRequiresNoTtyPatch()

Checks if the used Distribution requires a patch to use sudo without a tty.

New in version 4.0.4.3.

Returntype:bool
OPSI.Util.Task.Sudoers.patchSudoersFileForOpsi(sudoersFile=u'/etc/sudoers')

Patches the sudoers file so opsiconfd and the OPSI file admins can call opsi-set-rights.

Parameters:sudoersFile – The path to the sudoers file.
OPSI.Util.Task.Sudoers.patchSudoersFileToAllowRestartingDHCPD(dhcpdRestartCommand, sudoersFile=u'/etc/sudoers')

Patches the sudoers file so opsiconfd can restart the DHCP daemon and execute the service command without an tty.

Parameters:
  • dhcpdRestartCommand – The command used to restart the DHCP daemon
  • sudoersFile – The path to the sudoers file.