shinken-solutions / shinken

Flexible and scalable monitoring framework
http://www.shinken-monitoring.org
GNU Affero General Public License v3.0
1.13k stars 336 forks source link

Exception on configuration check #1411

Open jccomputing opened 9 years ago

jccomputing commented 9 years ago

When I use this invalid configuration, I get an exception instead of a proper error message:

define service {
  service_description            DummyService
  use                            generic-service
  check_command                  dummy_service_check
  register                       0
}
Traceback (most recent call last):
  File "/usr/bin/shinken-arbiter", line 7, in <module>
    execfile(__file__)
  File "/data/shinken-source/bin/shinken-arbiter", line 118, in <module>
    daemon.main()
  File "/data/shinken-source/shinken/daemons/arbiterdaemon.py", line 590, in main
    self.load_config_file()
  File "/data/shinken-source/shinken/daemons/arbiterdaemon.py", line 361, in load_config_file
    self.conf.create_objects(raw_objects)
  File "/data/shinken-source/shinken/objects/config.py", line 718, in create_objects
    self.create_objects_for_type(raw_objects, t)
  File "/data/shinken-source/shinken/objects/config.py", line 742, in create_objects_for_type
    setattr(self, prop, clss(lst, initial_index))
  File "/data/shinken-source/shinken/objects/item.py", line 709, in __init__
    self.add_items(items, index_items)
  File "/data/shinken-source/shinken/objects/item.py", line 729, in add_items
    self.add_template(i)
  File "/data/shinken-source/shinken/objects/service.py", line 1062, in add_template
    "host_name%s" % (objcls, tpl.get_source())
AttributeError: 'Service' object has no attribute 'get_source'

You get the error message when you correct the configuration, by changing service_description to name or by setting register to 1.

In my tests, I wasn't able to trigger this bug for a host

geektophe commented 9 years ago

I'll have a look at that. Thanks.