[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Naparuba
naparuba at gmail.com
Tue Feb 28 22:20:44 UTC 2012
The following commit has been merged in the debian/master branch:
commit 048acedfff6cfa0123fe7cd345fb4e1a3219402f
Author: Naparuba <naparuba at gmail.com>
Date: Tue Feb 14 15:19:46 2012 +0100
Fix : (reported by : H4wkmoon) STAR expand in hostgroup names was not looking as template property.
diff --git a/shinken/objects/item.py b/shinken/objects/item.py
index cbfd374..b9e2f13 100644
--- a/shinken/objects/item.py
+++ b/shinken/objects/item.py
@@ -1012,7 +1012,7 @@ class Items(object):
gn = gn.replace('-', HostGroup_Name_Parse_Ctx.minus_sign_in_name)
gn = gn.replace('print', HostGroup_Name_Parse_Ctx.print_in_name)
newgroupname2hostnames[gn] = val
-
+
set_res = []
try:
set_res = set(eval(str_setexpr, newgroupname2hostnames, {}))
@@ -1336,7 +1336,7 @@ def get_all_host_names_set(hosts):
return set(
h.host_name
for h in hosts.items.values()
- if getattr(h, 'host_name', '') != ''
+ if getattr(h, 'host_name', '') != '' and not h.is_tpl()
)
diff --git a/test/etc/nagios_1r_1h_1s.cfg b/test/etc/nagios_star_in_hostgroups.cfg
similarity index 89%
copy from test/etc/nagios_1r_1h_1s.cfg
copy to test/etc/nagios_star_in_hostgroups.cfg
index 1566c73..37c7f02 100644
--- a/test/etc/nagios_1r_1h_1s.cfg
+++ b/test/etc/nagios_star_in_hostgroups.cfg
@@ -8,14 +8,14 @@ auto_rescheduling_interval=30
auto_rescheduling_window=180
cached_host_check_horizon=15
cached_service_check_horizon=15
-cfg_file=1r_1h_1s/hosts.cfg
-cfg_file=1r_1h_1s/services.cfg
-cfg_file=1r_1h_1s/contacts.cfg
-cfg_file=1r_1h_1s/commands.cfg
-cfg_file=1r_1h_1s/timeperiods.cfg
-cfg_file=1r_1h_1s/hostgroups.cfg
-cfg_file=1r_1h_1s/servicegroups.cfg
-cfg_file=1r_1h_1s/shinken-specific.cfg
+cfg_file=star_in_hostgroups/hosts.cfg
+cfg_file=star_in_hostgroups/services.cfg
+cfg_file=star_in_hostgroups/contacts.cfg
+cfg_file=star_in_hostgroups/commands.cfg
+cfg_file=star_in_hostgroups/timeperiods.cfg
+cfg_file=star_in_hostgroups/hostgroups.cfg
+cfg_file=star_in_hostgroups/servicegroups.cfg
+cfg_file=star_in_hostgroups/shinken-specific.cfg
check_external_commands=1
check_for_orphaned_hosts=1
check_for_orphaned_services=1
diff --git a/test/etc/1r_1h_1s/commands.cfg b/test/etc/star_in_hostgroups/commands.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/commands.cfg
copy to test/etc/star_in_hostgroups/commands.cfg
diff --git a/test/etc/1r_1h_1s/contacts.cfg b/test/etc/star_in_hostgroups/contacts.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/contacts.cfg
copy to test/etc/star_in_hostgroups/contacts.cfg
diff --git a/test/etc/1r_1h_1s/hostgroups.cfg b/test/etc/star_in_hostgroups/hostgroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/hostgroups.cfg
copy to test/etc/star_in_hostgroups/hostgroups.cfg
diff --git a/test/etc/no_host_template/hosts.cfg b/test/etc/star_in_hostgroups/hosts.cfg
similarity index 84%
copy from test/etc/no_host_template/hosts.cfg
copy to test/etc/star_in_hostgroups/hosts.cfg
index 85c530c..1005536 100644
--- a/test/etc/no_host_template/hosts.cfg
+++ b/test/etc/star_in_hostgroups/hosts.cfg
@@ -52,10 +52,23 @@ define host{
+define hostgroup {
+ hostgroup_name all
+ alias All servers
+ members *
+}
-define host{
- address 127.0.0.1
- check_command check-host-alive-parent!up!$HOSTSTATE:test_router_0$
- host_name my_host
- use generic-host,missing-template
+define host {
+ use generic-host
+ host_name desktop08
+ address localhost
+ register 0
+}
+
+
+define service {
+ use generic-service
+ check_command check_service!ok
+ service_description TEST
+ hostgroup_name all
}
\ No newline at end of file
diff --git a/test/etc/1r_1h_1s/servicegroups.cfg b/test/etc/star_in_hostgroups/servicegroups.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/servicegroups.cfg
copy to test/etc/star_in_hostgroups/servicegroups.cfg
diff --git a/test/etc/1r_1h_1s/services.cfg b/test/etc/star_in_hostgroups/services.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/services.cfg
copy to test/etc/star_in_hostgroups/services.cfg
diff --git a/test/etc/1r_1h_1s/shinken-specific.cfg b/test/etc/star_in_hostgroups/shinken-specific.cfg
similarity index 100%
copy from test/etc/1r_1h_1s/shinken-specific.cfg
copy to test/etc/star_in_hostgroups/shinken-specific.cfg
diff --git a/test/etc/10r_1000h_20000s/timeperiods.cfg b/test/etc/star_in_hostgroups/timeperiods.cfg
similarity index 100%
copy from test/etc/10r_1000h_20000s/timeperiods.cfg
copy to test/etc/star_in_hostgroups/timeperiods.cfg
diff --git a/test/jenkins/longtests.txt b/test/jenkins/longtests.txt
index 558c9df..58d64c0 100644
--- a/test/jenkins/longtests.txt
+++ b/test/jenkins/longtests.txt
@@ -93,6 +93,7 @@ test_timeperiods_state_logs.py
test_groups_with_no_alias.py
test_define_with_space.py
test_objects_and_notifways.py
+test_star_in_hostgroups.py
test_parse_perfdata.py
# takes long
diff --git a/test/jenkins/shorttests.txt b/test/jenkins/shorttests.txt
index fa11196..8ec2c95 100644
--- a/test/jenkins/shorttests.txt
+++ b/test/jenkins/shorttests.txt
@@ -100,4 +100,5 @@ test_groups_with_no_alias.py
test_timeperiods_state_logs.py
test_define_with_space.py
test_objects_and_notifways.py
+test_star_in_hostgroups.py
test_parse_perfdata.py
diff --git a/test/quick_tests.sh b/test/quick_tests.sh
index 236b448..bef079c 100755
--- a/test/quick_tests.sh
+++ b/test/quick_tests.sh
@@ -138,6 +138,7 @@ launch_and_assert test_notif_too_much.py
launch_and_assert test_timeperiods_state_logs.py
launch_and_assert test_define_with_space.py
launch_and_assert test_objects_and_notifways.py
+launch_and_assert test_star_in_hostgroups.py
launch_and_assert test_maintenance_period.py
#Live status is a bit longer than the previous, so we put it at the end.
diff --git a/test/test_dot_virg_in_command.py b/test/test_star_in_hostgroups.py
similarity index 80%
copy from test/test_dot_virg_in_command.py
copy to test/test_star_in_hostgroups.py
index c931fc3..f37b36a 100755
--- a/test/test_dot_virg_in_command.py
+++ b/test/test_star_in_hostgroups.py
@@ -26,15 +26,17 @@
from shinken_test import *
-class TestConfig(ShinkenTest):
+class TestStarInGroups(ShinkenTest):
#Uncomment this is you want to use a specific configuration
#for your test
def setUp(self):
- self.setup_with_file('etc/nagios_dot_virg_in_command.cfg')
+ self.setup_with_file('etc/nagios_star_in_hostgroups.cfg')
- #Change ME :)
- def test_dummy(self):
+ # If we reach a good start, we are ok :)
+ # the bug was that an * hostgroup expand get all host_name != ''
+ # without looking at register 0 or not
+ def test_star_in_groups(self):
#
# Config is not correct because of a wrong relative path
# in the main config file
@@ -47,11 +49,8 @@ class TestConfig(ShinkenTest):
router = self.sched.hosts.find_by_name("test_router_0")
router.checks_in_progress = []
router.act_depend_of = [] # ignore the router
- svc = self.sched.services.find_srv_by_name_and_hostname("test_host_0", "test_ok_0")
- svc.checks_in_progress = []
- svc.act_depend_of = [] # no hostchecks on critical checkresults
- print svc.event_handler.args
- self.assert_('sudo -s pkill toto ; cd /my/path && ./toto' in svc.event_handler.args)
+ svc = self.sched.services.find_srv_by_name_and_hostname("test_host_0", "TEST")
+ self.assert_(svc is not None)
if __name__ == '__main__':
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list