summaryrefslogtreecommitdiffstats
path: root/examples/find_recalled_parts.py
blob: f9ca4bb09d7035afcfaa5eb687ee64f5ef0bcd0c (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
#!/usr/bin/python
# find all parts that need to be recalled
# (C) Michael DeHaan, 2007 <mdehaan@redhat.com>
# ===============================================

import func.overlord.client as fc

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

info = fc.Client("*").hardware.info()

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

    if type(details) != dict:
        print "%s had an error : %s" % (host,str(details))
        break

    for device in details["devices"]:
        for bad_value in bad:
           if device["Description"].find(bad_value) != -1:
              print "%s has flagged part: %s " % (host, device["Description"])
              break