summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-01-29 16:19:30 -0500
committerMichael DeHaan <mdehaan@redhat.com>2008-01-29 16:19:30 -0500
commitb3c5591d70c1c354d14267e804ab64872af97b40 (patch)
treea361f4d0ea060df23ffbccf9961f38bb01a65d23 /examples
parent1d60f197dab809e9a51c3377587d46370e698c52 (diff)
downloadthird_party-func-b3c5591d70c1c354d14267e804ab64872af97b40.tar.gz
third_party-func-b3c5591d70c1c354d14267e804ab64872af97b40.tar.xz
third_party-func-b3c5591d70c1c354d14267e804ab64872af97b40.zip
All exceptions, async or otherwise, now come back as easily detectable signatures. Use utils.is_error(result)
to determine if something is an error or isn't. Example scripts as well as func-inventory have been updated. See async_test.py for examples.
Diffstat (limited to 'examples')
-rw-r--r--examples/drive_checker.py5
-rw-r--r--examples/find_recalled_parts.py5
-rw-r--r--examples/service_checker.py1
3 files changed, 6 insertions, 5 deletions
diff --git a/examples/drive_checker.py b/examples/drive_checker.py
index 77e9181..f563c76 100644
--- a/examples/drive_checker.py
+++ b/examples/drive_checker.py
@@ -5,14 +5,15 @@
# ===============================================
import func.overlord.client as fc
+import func.utils as utils
info = fc.Client("*").smart.info()
failures = 0
for (host,details) in info.iteritems():
- if type(details) != list:
- print "%s had an error : %s" % (host,str(details))
+ if utils.is_error(details):
+ print "%s had an error : %s" % (host,details[1:3])
break
(rc, list_of_output) = details
diff --git a/examples/find_recalled_parts.py b/examples/find_recalled_parts.py
index fc1a3b1..45eb48e 100644
--- a/examples/find_recalled_parts.py
+++ b/examples/find_recalled_parts.py
@@ -4,6 +4,7 @@
# ===============================================
import func.overlord.client as fc
+import func.utils as utils
bad = open("./part_data.txt").read().split()
@@ -11,8 +12,8 @@ info = fc.Client("*").hardware.hal_info()
for (host,details) in info.iteritems():
- if type(details) != dict:
- print "%s had an error : %s" % (host,str(details))
+ if utils.is_error(details):
+ print "%s had an error : %s" % (host,details[1:3])
break
for (device, full_output) in details.iteritems():
diff --git a/examples/service_checker.py b/examples/service_checker.py
index 543290d..5541619 100644
--- a/examples/service_checker.py
+++ b/examples/service_checker.py
@@ -21,7 +21,6 @@
import sys
import func.overlord.client as fc
-
if __name__ == '__main__':
try:
service = sys.argv[1]