Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[system][wmi_check] handle TimeoutException #2228

Merged
merged 2 commits into from
Feb 12, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[core][wmi] list to cache connections
Use a `list` to cache WMI connections instead of a `set`.
yannmh committed Jan 26, 2016
commit 7ea6787b177280778790b81035bacfedc9b6a80c
4 changes: 2 additions & 2 deletions checks/libs/wmi/sampler.py
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ class WMISampler(object):
"""
# Shared resources
_wmi_locators = {}
_wmi_connections = defaultdict(set)
_wmi_connections = defaultdict(list)

def __init__(self, logger, class_name, property_names, filters="", host="localhost",
namespace="root\\cimv2", username="", password="", timeout_duration=10):
@@ -293,7 +293,7 @@ def get_connection(self):
yield connection

# Release it
self._wmi_connections[self.connection_key].add(connection)
self._wmi_connections[self.connection_key].append(connection)

@staticmethod
def _format_filter(filters):
2 changes: 1 addition & 1 deletion tests/core/test_wmi.py
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@ def tearDown(self):
# Flush cache
from checks.libs.wmi.sampler import WMISampler
WMISampler._wmi_locators = {}
WMISampler._wmi_connections = defaultdict(set)
WMISampler._wmi_connections = defaultdict(list)

def assertWMIConn(self, wmi_sampler, param=None, count=None):
"""
2 changes: 1 addition & 1 deletion tests/core/test_wmi_calculator.py
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ def test_calculator_decorator(self):
Asssign a calculator to a counter_type. Raise when the calculator is missing.
"""
@calculator(123456)
def do_something():
def do_something(*args, **kwargs):
"""A function that does something."""
pass