[rhn-users] Two new api scripts

Máirín Duffy duffy at redhat.com
Tue May 20 20:47:26 UTC 2008


Hi,

I just checked in a couple of scripts I thought you might find useful. 
They have long (but descriptive :) ) names. They will work in either RHN 
hosted or on a Satellite (note that they don't make use of the new 5.1 
Satellite APIs.)

1) list-all-errata-and-affected-systems.py

https://rhn-satellite.108.redhat.com/svn/rhnsat/trunk/api-script-examples/list-all-errata-and-affected-systems.py

This will spit out a list of all errata across your channels with a list 
of affected systems per errata. The format of the output is something 
like this:

Channel #1: Red Hat Enterprise Linux (v. 5 for 32-bit x86)

* Total Errata: 315
* Errata:

    * Errata #1: Skipping erratum RHSA-2008:0489 because it has no 
affected systems.

    * Errata #2:
       * Advisory: RHSA-2008:0275
       * Type: Security Advisory
       * Issue date: 2008-05-20 00:00:00
       * Synopsis: Important: kernel security and bug fix update

       * Affected Systems (1 system(s) affected):

          * System 1
             * System Name: tsukushi
             * System ID: 1007366565

2) list-all-systems-with-some-details.py

https://rhn-satellite.108.redhat.com/svn/rhnsat/trunk/api-script-examples/list-all-systems-with-some-details.py

This will spit out a list of all registered systems in your account. The 
output is something like below (a bit less neat than the errata script.) 
You have to provide the script an extra parameter, 'chunk size', which 
is how many systems at a time the script will retrieve before sleeping 
for a bit and continuing. I think if you set it to 50 you should be 
fine. If you notice the script timing out, set this value to be lower.

*************** NEW SYSTEM ***************

**** SYSTEM BASIC DETAILS ****

System ID: 1005766736
System Name: test profile - 21069

**** SYSTEM ENTITLEMENT DETAILS ****

Entitlement: enterprise_entitled
Entitlement: provisioning_entitled

**** SYSTEM SOFTWARE CHANNEL DETAILS ****

Base Channel ID: 54
Base Channel Name: Red Hat Enterprise Linux AS (v. 2.1 for i386)
Base Channel Label: redhat-advanced-server-i386

Channel ID: 247
Channel Name: Red Hat Network Proxy (v1.1 for AS v2.1 x86)
Channel Label: redhat-rhn-proxy-as-i386-2.1
Channel Summary: Red Hat Network Proxy (v1.1 for AS v2.1 x86)

Channel ID: 1491
Channel Name: Red Hat Network Tools for RHEL 2.1 AS (i386)
Channel Label: rhn-tools-rhel-2.1-as-i386
Channel Summary: Red Hat Network Tools for RHEL 2.1 AS (i386)

Channel ID: 1713
Channel Name: Red Hat Network Proxy (v3.2 for AS v2.1 x86)
Channel Label: redhat-rhn-proxy-3.2-as-i386-2.1
Channel Summary: Red Hat Network Proxy (v3.2 for AS v2.1 x86)

Channel ID: 1757
Channel Name: Red Hat Enterprise Linux AS (v. 2.1 for x86) Beta
Channel Label: rhel-i386-as-2.1-beta
Channel Summary: Red Hat Enterprise Linux AS (v. 2.1 for x86) Beta

Channel ID: 2796
Channel Name: Red Hat Network Proxy (v3.6 for AS v2.1 x86)
Channel Label: redhat-rhn-proxy-3.6-as-i386-2.1
Channel Summary: Red Hat Network Proxy (v3.6 for AS v2.1 x86)

Channel ID: 3154
Channel Name: Red Hat Network Proxy (v3.7 for AS v2.1 x86)
Channel Label: redhat-rhn-proxy-3.7-as-i386-2.1
Channel Summary: Red Hat Network Proxy (v3.7 for AS v2.1 x86)

**** SYSTEM GROUP MEMBERSHIPS ****


---

As always feel free to extend/adapt these scripts to whatever your 
liking/needs. They are both LGPL.

~m




More information about the rhn-users mailing list