summaryrefslogtreecommitdiffstats
path: root/examples/find_recalled_parts.py
blob: 36c4a7cc51678250b317ba00da7160fb50294c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
# find all parts that need to be recalled
# (C) Michael DeHaan, 2007 <mdehaan@redhat.com>
# ===============================================

import func.overlord.client as fc
import func.utils as utils

bad = open("./part_data.txt").read().split()

info = fc.Overlord("*").hardware.hal_info()

for (host,details) in info.iteritems():

    if utils.is_error(details):
        print "%s had an error : %s" % (host,details[1:3])
        break

    for (device, full_output) in details.iteritems():
        for bad_value in bad:
             if full_output.find(bad_value) != -1:
                print "%s has flagged part: %s, matched %s" % (host, device, bad_value)
                break