Apt¶
- class rmote.tools.apt.Apt[source]¶
Bases:
ToolManage Debian/Ubuntu packages via apt-get. Requires root on the remote host.
- classmethod converge(*packages)[source]¶
Ensure all packages are present, reading dpkg status once for efficiency.
- classmethod package(package, state=State.PRESENT)[source]¶
Install, remove, or upgrade a single package.
- Parameters:
package (
Text|Package) – Package name,name=versionstring, or aPackageinstance.state (
State|int) – Desired state -State.PRESENT(install if absent),State.ABSENT(purge if installed), orState.LATEST(install or upgrade to candidate version).
- Return type:
- Returns:
Resultwith the package name, installed version, and whether the system was changed.- Raises:
RuntimeError – If the underlying
apt-getinvocation fails.
- static update(ttl=-1)[source]¶
Run
apt-get update, with optional TTL-based skipping.- Parameters:
ttl (
int|float) – Minimum age in seconds of the last successful update before re-running.-1(default) always runs the update.- Return type:
- Returns:
Trueifapt-get updatewas executed,Falseif the cache is fresher than ttl seconds.- Raises:
RuntimeError – If
apt-get updateexits with a non-zero status.