Git Product home page Git Product logo

package-agent's Introduction

Choria Package Agent

The package agent that lets you install, uninstall, update, purge and query the status of packages on your system.

This agent can be extended to support different Package managers, by default it uses Puppet. See the section later in this document about extendibility.

Installation

This agent is installed by default as part of the Choria Orchestrator.

Configuration

There is one plugin configuration setting for the package agent.

  • provider - The Util class that implements the install, uninstall, purge, update and status behavior. Defaults to 'puppet'

General provider configuration options can then also be set in the config file.

mcollective_agent_package::config:
  provider: puppet
  puppet.allowcdrom: true

Authorization

By default the Action Policy system is configured to only allow status and count and md5 actions from all users. These are read only and does not expose secrets.

Follow the Choria documentation to configure your own policies either site wide or per agent.

If you do configure any Policies specific to this module these defaults will be overriden when done using Hiera.

An example policy can be seen here:

mcollective_agent_package::policies:
  - action: "allow"
    callers: "choria=manager.mcollective"
    actions: "install update uninstall purge"
    facts: "*"
    classes: "*"

Usage

% mco rpc package install package=nano

 * [ ============================================================> ] 4 / 4



Summary of Ensure:

   2.0.9-7.el6 = 4


Finished processing 4 / 4 hosts in 18176.83 ms
% mco package nano uninstall

 * [ ============================================================> ] 4 / 4


Summary of Ensure:

   absent = 4


Finished processing 4 / 4 hosts in 393.68 ms
% mco rpc package install package=openssl version=0.9.8k-7ubuntu8

 * [ ============================================================> ] 4 / 4



Summary of Ensure:

   0.9.8k-7ubuntu8 = 4


Finished processing 4 / 4 hosts in 18176.83 ms

Data Plugin

The Package agent also supplies a data plugin which uses the Package agent to check the current status of a package. The data plugin will set installed to true/false if the package is not installed or not, and will set status to the currently installed version if it is present and can be used during discovery or any other place where the MCollective discovery language is used.

mco rpc rpcutil ping -S "package('mypackage').installed=false"

mco rpc rpcutil ping -S "package('mypackage').status=3.2-1"

Extending

The default package agent achieves platform portability by using the Puppet provider system to support package managers on all platforms that Puppet supports.

If however you are not a Puppet user or simply want to implement some new method of package management you can do so by providing your own backend provider for this agent.

The logic for the Puppet version of this agent is implemented in Util::Package::PuppetPackage, you can create a custom package implementation that overrides #install, #uninstall, #update, #purge and #status.

This agent defaults to Util::Package::PuppetPackage but if you have your own you can configure it in the config file using:

mcollective_agent_package::config:
  provider: puppet

There is an example YumPackage that manages YUM based systems without Puppet that you can look to for an example.

package-agent's People

Contributors

br0ch0n avatar cristi- avatar davewongillies avatar fiddyspence avatar foxxx0 avatar frangm avatar gunzl1ng3r avatar haus avatar koendierckx avatar melissa avatar mikaelsmith avatar mruzicka avatar nicklewis avatar ploubser avatar reguero avatar richardc avatar ripienaar avatar smortex avatar teancom avatar treydock avatar vjanelle avatar

Watchers

 avatar  avatar  avatar

package-agent's Issues

"mco package apt_checkupdates" gives no package information output

Ubuntu 16.04 lts
apt 1.2.27 (amd64)
puppet 4.10.12
choria 0.5.0
mco 2.10.6

mco package apt_checkupdates
Do you really want to operate on packages unfiltered? (y/n): y

  • [ ============================================================> ] 17 / 17
    Finished processing 17 / 17 hosts in 1548.26 ms

mco package apt_checkupdates -v
Do you really want to operate on packages unfiltered? (y/n): y
Discovering hosts using the mc method for 2 second(s) .... 17

  • [ ============================================================> ] 17 / 17
    puppet.local:
    test.local:
    ....
    ---- apt_checkupdates Package results ----
    Nodes: 17 / 17
    Pass / Fail: 17 / 0
    Start Time: 2018-08-06 09:20:05 +0200
    Discovery Time: 2030.01ms
    Agent Time: 2934.38ms
    Total Time: 4964.39ms

I would expect the hosts to show the packages that have updates, and the version information for those packages.

What can I do to help find the cause of the problem ?

Implement helper actions for FreeBSD pkg

The module provide helpers (e.g. for listing outdated packages) which use custom code since the Puppet providers are not providing this information.

Implementing these helpers for pkg would allow to use these helpers on FreeBSD.

Add a refresh actions to update available packages

Some package managers provide different actions for refreshing available package list and for listing available updates. apt is one of them and therefore has 2 actions:

  • apt_update
  • apt_checkupdates

The checkupdates actions call apt_checkupdates when the package provider is apt, but update is not an alias for apt_update: it is used to actually update a package to the latest available version.

With a single refresh action, we can act regardless of the package manager. This action should update the package list if available and return the list of available updates as checkupdate does.

`mco package apt_update` is broken

Running mco package apt_update on Debian GNU/Linux systems fails with:

% mco package apt_update      
Do you really want to operate on packages unfiltered? (y/n): y

 * [ ============================================================> ] 21 / 21


The package application failed to run, use -v for full error backtrace details: undefined method `map' for nil:NilClass

% mco package apt_update -I /vps/ -v    
Discovering hosts using the mc method for 2 second(s) .... 8

 * [ ============================================================> ] 8 / 8


The package application failed to run: undefined method `map' for nil:NilClass

undefined method `map' for nil:NilClass (NoMethodError)
	from /usr/local/share/mcollective/application/package.rb:97:in `block in main'  <----
	from /usr/local/share/mcollective/application/package.rb:91:in `each'
	from /usr/local/share/mcollective/application/package.rb:91:in `main'
	from /usr/local/lib/ruby/site_ruby/2.4/mcollective/application.rb:293:in `run'
	from /usr/local/lib/ruby/site_ruby/2.4/mcollective/applications.rb:23:in `run'
	from /usr/local/bin/mco:33:in `<main>'

Cannot purge uninstalled packages

Debian packages can be uninstalled (remove all package files) or purged (also remove configuration files and user data), i.e. uninstalling then reinstalling mysql has no impact on the database configuration and data, but purging then reinstalling removes all data and the system is in its default configuration.

Currently, the purge action for the package agent is noop if the package is uninstalled, making it impossible to use the agent to remove leftovers by purging after uninstalling a package.

DNF support

CentOS 8 introduces yet-another-package manager, with new APIs and locations for python.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.