Packages agent for MCollective - a agent to install/upgrade/downgrade multiple packages at a time.
When using MCollective to roll-out changes in a Contiuous Delivery environment, the included "package" agent has some shortcomings. So I decided to write a "packages" agent to improve the situation.
I use MCollective to roll out changes from contiuous integration. Rollouts are 1x per hour and can involve up to 20 packages.
These were my requirements, which are now the features of the packages agent
- The client does not know wether a package is already installed or not.
- Allow install, update and downgrade.
- Handle multiple packages in one operation.
- Respond with a list of packages and their exact version/revision installed.
- Re-try operations when they fail.
- Include "yum clean expire-cache" / "apt-get update"
This agent was originally written with CentOS 5 and Scientific Linux 6.1 in mind. It includes ~20 rspec tests for both agent and application.
Invokation is: mco packages uptodate [/[/]] Examples: mco packages -F roles=/webservice/ uptodate inbox-service/0.12.0/1 queue-processor/0.5.0/1
Have a look at agent/puppet-packages.rb.
Test environmment (CentOS/SL)
The tests currently use yum directly, so they will only work on RedHat bases distros. It is also assumed, that the test run as root.
Also, a number of packages must be available in specific versions. I created "dummy" or "fake" rpms and setup a test yum repository.
Find a little script to generate dummy rpm packages in the util/ directory.
These packages are expected by the tests. Create them with the rpm-generator script and make them available to yum (eg. put them on a private yum repo)
test-ws-1.0-0.1.0SNAPSHOT-1111.el6.x86_64.rpm test-ws-1.0-0.1.0SNAPSHOT-2222.el6.x86_64.rpm test-ws-1.0-0.1.0SNAPSHOT-3333.el6.x86_64.rpm testtool-1.3.0-23.el6.x86_64.rpm testupdate-2.0-1.el6.x86_64.rpm testupdate-2.1-1.el6.x86_64.rpm
Due to the way the puppet package provider works, both version and revision have to be given. Version only is not supported.
In order to run the tests under Ubuntu 12.04, do
apt-get install rubygem19-mcollective-test rubygem19-mocha rubygem19-fpm
- generate a GPG key
- build the packages needed:
Licensed under BSD License. email@example.com