Check Updates Yum Method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm writing an application that will, for a number of machines on a
network, gather the list of due updates.  I'm using func as the
enabler for the application, and am looking at adding a check_updates
method to the yum minion module.

One particular requirement is that each machine has its yum repos
disabled by default, so the update method needs to be able to enable a
repository.

In my environment I'm using yum 2.4, and the following python does the trick:

import yum
from yum import repo
y = yum.YumBase()
y.doConfigSetup()
y,doTsSetup()
y.repos.enableRepo('engineering')
y.doPackageLists('updates').updates

As a first cut I've written the following method for the yum minion module:

def check_update(self, repo=None):
        """Returns a list of packages due to be updated"""
        ayum = yum.YumBase()
        ayum.doConfigSetup()
        ayum.doTsSetup()
        ayum.repo.enableRepo(repo)
        return ayum.doPackageLists('updates').updates

Testing gives this:

>>> import func.overlord.client as fc
>>> client = fc.Client("*")
>>> client.yum.check_update('engineering')
{'test.fs-server.com': <Fault 1: 'func.minion.codes.InvalidMethodException:'>}

This suggests that the check_update method isn't available?  I've
added it to /usr/lib/python2.3/site-packages/func/minion/modules/yum.py
on the minion.

A few questions:

1) Is this a reasonable approach to the problem
2) What am I doing wrong, such that the method isn't available
3) Is there a test suite for yum?  I tend to like to code test-first,
so am feeling a little uncomfortable coding and hoping.

Thanks,

S.


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux