wiki:Development/Templates/ClientSideDepsCheck

Version 20 (modified by /O=GRID-FR/C=FR/O=CNRS/OU=LAL/CN=Michel Jouvin, 16 years ago) (diff)

--

Checking Package Dependencies in a Profile

One of the annoying things about Quattor is that you can't check that a package set defined in a profile is consistent, i.e. that it doesn't require any more packages added to resolve dependencies. This can result in a frustrating sequence of "tweak package list, deploy profiles, run SPMA, check for dependency errors". The problem is that dependency information is not available when compiling profiles.

However, there is a tool that's very good at resolving dependency problems, and it's called YUM. The following recipe gives details of using YUM and a python utility called checkdeps (available at src/utils/profiles/checkdeps) to detect dependency problems and suggest a solution. I've found that it takes about 30 seconds to check a profile, so you probably only want to do this for profiles that are causing problems, or as a final pre-deployment check.

Create YUM repositories

You will need to turn your existing Quattor repositories into YUM repositories. Make sure that createrepo is installed on your repository server and then issue this command for every directory used as a target for a Quattor software repository:

createrepo <repository root>

For example, to convert the repository ca rooted at /var/www/html/ca issue this command:

createrepo /var/www/html/ca

Set up YUM on your development machine

Install YUM

If YUM isn't installed, you will need to install it on the machine where you normally develop Quattor profiles. Note that that checkdeps.py has been tested with YUM version 3.2.8 (as used in Fedora 8).

Set up a directory for YUM

You will need to create a directory for YUM to store its metadata in. Any directory will do. This will be passed in to checkdeps as its working directory.

Create a YUM config file

This can be very basic. The minimum we need is the location of the directory where the YUM templates describing the repositories are stored.

[main]
reposdir=/home/username/yumroot
installroot=/home/myusername/yumroot

Generate YUM repository files

For each Quattor repository, you will need to define YUM files describing the repository. These must have the same names in YUM and Quattor. The easiest thing is to let checkdeps generate these for you for the profile you're trying to check. If you pass checkdeps the -g flag it will do this for you.

Get checkdeps

checkdeps is available in the SCDB distribution at src/utils/profiles/checkdeps.py

Run checkdeps

Here is the output when your profile is consistent:

[childss@frascati checkdeps]$ ./checkdeps.py -x gridgate.cs.tcd.ie.xml -c yum.quattor.conf -r ~/yumroot/ -g
checkdeps: Reading package list from target file gridgate.cs.tcd.ie.xml
checkdeps: Adding 1007 packages to install list
checkdeps: Calling YUM to check dependencies for package list
checkdeps: YUM didn't need to add any packages, profile seems OK.

If we remove a package from the profile and run again, we get this:

[childss@frascati checkdeps]$ ./checkdeps.py -x gridgate.cs.tcd.ie.broken.xml -c yum.quattor.conf -r ~/yumroot/ -g
checkdeps: Reading package list from target file gridgate.cs.tcd.ie.broken.xml
checkdeps: Adding 1006 packages to install list
checkdeps: Calling YUM to check dependencies for package list
YUM wants to add 1 new packages that are missing from profile:

Package                             Version                      Needed by
================================================================================
glite-security-voms-admin-interface 1.0.5-1.noarch               lcg-CE_torque

YUM detects a dependency problem and suggests a solution. The list of enabled repositories was generated from those contained in the profile, so the package suggested should be sensible.

If you add the -p flag, then the program will output Pan lines adding the package (using pkg_repl) for easy cut-and-paste into the offending profile!

Troubleshooting

No handlers could be found…

Yum changes the API from one version to another. This means, that you are using an old version and you should upgrade. This script has been tested on Yum versions for Fedora 8 and 9. You should use, at least, version 3.2.8.

If you are using SL4 or SL5, you'll have to build Yum. Or you can get the RPM from UAM's build.

Errors on packages while checking dependencies

First, check your yum configuration. If it's all right, it means that you upgraded Yum following the steps above, but the repository metadata was created with an older version of createrepo.

Again, you must upgrade createrepo to a newer version, which might involve re-building the RPM or downloading it from UAM's repository.