[Spacewalk-list] Using API to install updates

Joshua Roys joshua.roys at gtri.gatech.edu
Mon Jun 14 20:08:48 UTC 2010


On 06/14/2010 12:14 PM, Tom Brown wrote:
> Hi
> 
> Does anyone have any examples of using the API to install package updates?
> 
> What i am trying to achieve is automatic installation of available
> updates without having to go via the web gui and without using a yum
> update.
> 
> Is that possible?
> 

Hello,

Yes, it definitely is.  I'll attach a python script we use here, but if
you want to write your own, a useful resource is the API docs (which can
be found at http://$your_spacewalk/rhn/apidoc/ .

Some notes on our script:
- it uses the local /etc/yum.conf "exclude" directive to mask packages
that will be pushed for updates
- inactive or locked systems will not have updates pushed out to them
- the script does its best to try to not schedule duplicate updates (it
looks at pending events and masks out packages that are currently queued)
- there's a commented-out block at the end that can apply errata, too-
although it does not currently respect the yum.conf excludes (*note*:
without this, updates /with/ errata will not be applied!)

Two bugs:
- clients will occasionally fail to install updates (although they will
be re-queued next run) for one of two reasons: the repodata isn't
written out yet that contains the new package information, or they use
the yum cache and again don't see the package.  In at least one of these
cases, I've seen a "success" returned- although, again, the package will
get re-queued the next run.
- there was a bug (rhbz 588901) in system.listLatestUpgradablePackages
that returned too many packages.  This should be fixed in sw1.1.

Also, as Tomas said, there is a checkbox in the webui as well, but that
only applies updates with errata.

Hope to help,

Josh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pushLatestPackages.py
Type: text/x-python
Size: 2864 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20100614/858f9b03/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3086 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20100614/858f9b03/attachment.p7s>


More information about the Spacewalk-list mailing list