Exemple #1
0
    def install_packages(self):
        """
        Install system packages.
        """

        packages = get_package_db().resolve(*self._packages).values()

        get_package_manager().install(packages)
Exemple #2
0
    def do_refresh(params):

        pm = get_package_manager()
        (success, needs_update) = pm.refresh()

        return AgentRequestHandler._format_response(
            {
                'needs_update': needs_update
            },
            success,
            int(success)
        )
Exemple #3
0
    def do_uninstall(params):

        pm = get_package_manager()
        pdb = get_package_db()

        packages = pdb.resolve(*params['packages'])
        status = pm.uninstall(packages)

        return AgentRequestHandler._format_response(
            None,
            True,
            1
        )
Exemple #4
0
    def do_install(params):
        """
        Install a DNS server.
        """

        pm  = get_package_manager()
        pdb = get_package_db()

        status = pm.install(pdb.resolve('powerdns-authoritative'))

        return AgentRequestHandler._format_response(
            successful=status,
            error_code=0
        )
Exemple #5
0
    def do_update(params):

        pm = get_package_manager()
        pm.refresh()

        if 'upgrade' in params and params['upgrade']:
            upgrade = True
        else:
            upgrade = False
        success = pm.update(upgrade)

        return AgentRequestHandler._format_response(
            '',
            success,
            int(success)
        )