Skip to content

Instantly share code, notes, and snippets.

@eedgar
Created November 20, 2012 18:10
Show Gist options
  • Save eedgar/4119740 to your computer and use it in GitHub Desktop.
Save eedgar/4119740 to your computer and use it in GitHub Desktop.
ovirt timeout fix.
diff --git a/ZenPacks/zenoss/oVirt/poll_ovirt.py b/ZenPacks/zenoss/oVirt/poll_ovirt.py
index a7b1084..5641000 100755
--- a/ZenPacks/zenoss/oVirt/poll_ovirt.py
+++ b/ZenPacks/zenoss/oVirt/poll_ovirt.py
@@ -735,7 +735,11 @@ class oVirtPoller(object):
os._exit(1)
# Nic statistics to be processed later.
- deferred_statistics.append(self.client.request(elementtree_to_dict(nic.getchildren()[0])['link']['href'].split('/api/')[1]))
+ try:
+ deferred_statistics.append(self.client.request(elementtree_to_dict(nic.getchildren()[0])['link']['href'].split('/api/')[1]))
+ except Exception:
+ # There may be 0 nic's attached.
+ pass
# Gather the VM statistics and its disk/network component statistics.
if 'vms' in data:
@@ -762,7 +766,11 @@ class oVirtPoller(object):
os._exit(1)
# Disk statistics to be processed later.
- deferred_statistics.append(self.client.request(elementtree_to_dict(disk.getchildren()[0])['link']['href'].split('/api/')[1]))
+ try:
+ deferred_statistics.append(self.client.request(elementtree_to_dict(disk.getchildren()[0])['link']['href'].split('/api/')[1]))
+ except Exception:
+ # There may be 0 disks attached.
+ pass
# Grab Nic statistics
try:
@@ -781,7 +789,11 @@ class oVirtPoller(object):
os._exit(1)
# Nic statistics to be processed later.
- deferred_statistics.append(self.client.request(elementtree_to_dict(nic.getchildren()[0])['link']['href'].split('/api/')[1]))
+ try:
+ deferred_statistics.append(self.client.request(elementtree_to_dict(nic.getchildren()[0])['link']['href'].split('/api/')[1]))
+ except Exception:
+ # There may be 0 nic's attached.
+ pass
"""DeferredLists do NOT need try/except handling when consumeErrors are True
We check its results for problems later.
diff --git a/setup.py b/setup.py
index 2df2946..8553547 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.zenoss.oVirt"
-VERSION = "1.1.1"
+VERSION = "1.1.2"
AUTHOR = "Zenoss Labs <labs@zenoss.com>"
LICENSE = "GPLv2"
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.zenoss']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment