Platform requirements

Import the checks from rmote.requires. A tool that reads a kernel interface of Linux, or runs the program of one distribution, calls one of them before it touches that interface. The refusal is NotImplementedError, and its message names the operation, what it needs and what the host is:

Sysctl.get needs the /proc/sys interface of Linux, and this host runs Darwin
Service needs the systemctl program of systemd, and this host has none
AptRepository.absent needs /etc/apt of Debian and Ubuntu, and this host has none

The reason has to be in the message, because the failure travels through RPC and the caller sees the exception and nothing else. A missing file or a missing program on its own reads like a damaged host instead of the wrong one. See Built-in Tools for what each built-in tool needs.

A tool of your own uses the same checks. The module transfers on demand, like every other module a tool imports.

rmote.requires.needs_linux(operation, source)[source]

Refuse operation unless this target is Linux.

Parameters:
  • operation (Text) – What the caller asked for, such as Sysctl.get.

  • source (Text) – The kernel interface that the operation reads or writes.

Raises:

NotImplementedError – The target runs another system.

Return type:

None

rmote.requires.needs_program(operation, name, provider)[source]

Refuse operation unless the program name is on the PATH.

Parameters:
  • operation (Text) – What the caller asked for, such as Service.start.

  • name (Text) – The program that the operation runs.

  • provider (Text) – What installs that program, such as systemd.

Raises:

NotImplementedError – The program is absent, so the operation has no way to run on this host.

Return type:

None

rmote.requires.needs_file(operation, path, provider)[source]

Refuse operation unless the configuration of provider is present.

Parameters:
  • operation (Text) – What the caller asked for, such as AptRepository.present.

  • path (Path) – The file or directory that the configuration of provider owns.

  • provider (Text) – Whose configuration it is, such as Debian and Ubuntu.

Raises:

NotImplementedError – The configuration is absent, so this host does not have the system the operation configures.

Return type:

None