fabtools.deb

Debian packages

This module provides tools to manage Debian/Ubuntu packages and repositories.

fabtools.deb.update_index(quiet=True)[source]

Update APT package definitions.

fabtools.deb.upgrade(safe=True)[source]

Upgrade all packages.

fabtools.deb.is_installed(pkg_name)[source]

Check if a package is installed.

fabtools.deb.install(packages, update=False, options=None)[source]

Install one or more packages.

If update is True, the package definitions will be updated first, using update_index().

Extra options may be passed to apt-get if necessary.

Example:

import fabtools

# Update index, then install a single package
fabtools.deb.install('build-essential', update=True)

# Install multiple packages
fabtools.deb.install([
    'python-dev',
    'libxml2-dev',
])
fabtools.deb.uninstall(packages, purge=False, options=None)[source]

Remove one or more packages.

If purge is True, the package configuration files will be removed from the system.

Extra options may be passed to apt-get if necessary.

fabtools.deb.preseed_package(pkg_name, preseed)[source]

Enable unattended package installation by preseeding debconf parameters.

Example:

import fabtools

# Unattended install of Postfix mail server
fabtools.deb.preseed_package('postfix', {
    'postfix/main_mailer_type': ('select', 'Internet Site'),
    'postfix/mailname': ('string', 'example.com'),
    'postfix/destinations': ('string', 'example.com, localhost.localdomain, localhost'),
})
fabtools.deb.install('postfix')
fabtools.deb.get_selections()[source]

Get the state of dkpg selections.

Returns a dict with state => [packages].

fabtools.deb.add_apt_key(filename, update=True)[source]

Trust packages signed with this public key.

Example:

import fabtools

# Download 3rd party APT public key
if not fabtools.is_file('rabbitmq-signing-key-public.asc'):
    run('wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')

# Tell APT to trust that key
fabtools.deb.add_apt_key('rabbitmq-signing-key-public.asc')

Project Versions

Table Of Contents

Previous topic

fabtools.cron

Next topic

fabtools.files

This Page