summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-26 16:35:26 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-26 16:35:26 -0400
commit62b705f2ef608e212229a234b9e53cf60f9dd83f (patch)
treefba54967c876c3e82845a269f140e488b21123a8 /examples
parent75c6680924f61c409bcedee8428923282a9096f7 (diff)
downloadfunc-62b705f2ef608e212229a234b9e53cf60f9dd83f.tar.gz
func-62b705f2ef608e212229a234b9e53cf60f9dd83f.tar.xz
func-62b705f2ef608e212229a234b9e53cf60f9dd83f.zip
The addition of an example program to find which systems have parts subject to recall.
Diffstat (limited to 'examples')
-rw-r--r--examples/find_recalled_parts.py24
-rw-r--r--examples/part_data.txt12
2 files changed, 36 insertions, 0 deletions
diff --git a/examples/find_recalled_parts.py b/examples/find_recalled_parts.py
new file mode 100644
index 0000000..f9ca4bb
--- /dev/null
+++ b/examples/find_recalled_parts.py
@@ -0,0 +1,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
+
+
diff --git a/examples/part_data.txt b/examples/part_data.txt
new file mode 100644
index 0000000..3d2cf3a
--- /dev/null
+++ b/examples/part_data.txt
@@ -0,0 +1,12 @@
+#-BAD-ITEM-PARTS
+92P1072 92P1073 92P1088 92P1089 92P1142 92P1141 92P1170", "92P1169",
+93P5028 92P1174 92P1173 93P5030
+
+#-BAD-DELL-PARTS
+1K055 C5446 F2100 KD494 W5915 Y1333 3K590 C6269 F5132 OR33X5308 Y4500 5P474
+C6270 GD785 M3006 X5329 Y5466 6P922 D2961 H3191 RD857 X5332 C2603 D5555 J1524 TD349
+X5333 C5339 D6024 JD616 U5867 X5875 C5340 D6025 JD617 U5882 X5877
+
+#-RANDOM-STUFF-SO-GET-A-FALSE-POSITIVE
+SCSI
+