[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Naparuba
naparuba at gmail.com
Tue Feb 28 22:16:16 UTC 2012
The following commit has been merged in the debian/master branch:
commit 2de1be3a0cf3f90cdf76943585131cd07981f4fd
Author: Naparuba <naparuba at gmail.com>
Date: Thu Jan 26 09:48:05 2012 +0100
Fix : discovery test.
diff --git a/shinken/objects/discoveryrule.py b/shinken/objects/discoveryrule.py
index 3ebf7bd..abe8ff4 100644
--- a/shinken/objects/discoveryrule.py
+++ b/shinken/objects/discoveryrule.py
@@ -165,7 +165,7 @@ class Discoveryrule(Item):
for m in self.matches:
#print "Compare to", m
match_one = False
- for (k, v) in datas:
+ for (k, v) in datas.iteritems():
# We found at least one of our match key
if m == k:
if self.is_matching(k, v):
@@ -183,7 +183,7 @@ class Discoveryrule(Item):
for m in self.not_matches:
#print "Compare to NOT", m
match_one = False
- for (k, v) in datas:
+ for (k, v) in datas.iteritems():
#print "K,V", k,v
# We found at least one of our match key
if m == k:
diff --git a/test/test_discovery_def.py b/test/test_discovery_def.py
index e25a89b..d53de6e 100755
--- a/test/test_discovery_def.py
+++ b/test/test_discovery_def.py
@@ -51,14 +51,14 @@ class TestDiscoveryConf(ShinkenTest):
self.assert_(genhttp.is_matching(key, value) == True)
# Low look for a list of matchings
- l = [('openports', '80'), ('os', 'windows')]
+ l = {'openports': '80', 'os': 'windows'}
# should match this
self.assert_(genhttp.is_matching_disco_datas(l) == True)
# Match this one too
- l = [('openports', '80'), ('os', 'windows'), ('super', 'man')]
+ l = {'openports' : '80', 'os': 'windows', 'super' : 'man'}
self.assert_(genhttp.is_matching_disco_datas(l) == True)
# But not this one
- l = [('openports', '80')]
+ l = {'openports' : '80'}
self.assert_(genhttp.is_matching_disco_datas(l) == False)
@@ -66,11 +66,11 @@ class TestDiscoveryConf(ShinkenTest):
genhttpnowin = self.sched.conf.discoveryrules.find_by_name('GenHttpNotWindows')
# Should manage this
- l = [('openports', '80'), ('os', 'linux')]
+ l = {'openports' : '80', 'os': 'linux'}
self.assert_(genhttpnowin.is_matching_disco_datas(l) == True)
# But NOT this one
- l = [('openports', '80'), ('os', 'windows')]
+ l = {'openports' : '80', 'os': 'windows'}
print "Should NOT match"
self.assert_(genhttpnowin.is_matching_disco_datas(l) == False)
@@ -124,14 +124,14 @@ class TestDiscoveryConf(ShinkenTest):
self.assert_(genhttp.is_matching(key, value) == True)
# Low look for a list of matchings
- l = [('openports', '80'), ('os', 'windows')]
+ l = {'openports': '80', 'os' : 'windows'}
# should match this
self.assert_(genhttp.is_matching_disco_datas(l) == True)
# Match this one too
- l = [('openports', '80'), ('os', 'windows'), ('super', 'man')]
+ l = {'openports' : '80', 'os': 'windows', 'super': 'man'}
self.assert_(genhttp.is_matching_disco_datas(l) == True)
# And this last one
- l = [('openports', '80')]
+ l = {'openports': '80'}
self.assert_(genhttp.is_matching_disco_datas(l) == True)
print "Writing properties"
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list