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

WiP: Clean elements groups and refactor configuration warnings/errors logging #331

Merged
merged 40 commits into from
Sep 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2036084
Hostgroup members (#110) and tests refactoring
mohierf Sep 12, 2016
7ea1181
Hostgroup members (#110) and tests refactoring (2)
mohierf Sep 12, 2016
037c949
Hostgroup members (#110) and tests refactoring (2)
mohierf Sep 12, 2016
2166b17
Make service and service group have interface similar to host / hostg…
mohierf Sep 12, 2016
6516705
Partial commit for service groups
mohierf Sep 12, 2016
67115bf
Partial commit for service groups share for testing
mohierf Sep 12, 2016
7b2d163
All hostgroup tests in one test class
mohierf Sep 12, 2016
9da76c6
Refactor test for service groups
mohierf Sep 12, 2016
d573039
Clean hostgroups tests
mohierf Sep 12, 2016
251fe69
Remove forgotten debug print
mohierf Sep 12, 2016
03be436
Improve contactgroup tests
mohierf Sep 12, 2016
e122545
Fix pylint :/
mohierf Sep 12, 2016
327b4ce
Refactore hostdependency tests
mohierf Sep 13, 2016
7612cfd
AlignakTest: clean broks and logs. @ddurieux: have a look please
mohierf Sep 13, 2016
55e0d26
Alignak, loading configuration - dump warnings and errors after confi…
mohierf Sep 13, 2016
faf137e
Configuration check: correctly handle warnings and errors
mohierf Sep 13, 2016
ca701b4
Configuration loading: services, hostgroups
mohierf Sep 13, 2016
bfe65b9
Fix pep8
mohierf Sep 13, 2016
045cc4d
Ignore the special properties in is_correct required properties check…
mohierf Sep 13, 2016
cf05b30
Clean comments
mohierf Sep 13, 2016
a221e98
Clean checkmodulation
mohierf Sep 13, 2016
71d8727
Rename few _special_properties as special_properties (most oftenly us…
mohierf Sep 13, 2016
a524ced
Clean contacts, escalations, modulations
mohierf Sep 13, 2016
0e5fdd2
Clean hostdependency, fix #333
mohierf Sep 13, 2016
b7afbe6
Still some cleaning
mohierf Sep 13, 2016
3470fab
Fix pep8
mohierf Sep 13, 2016
f604663
Improve configuration warnings/errors logging
mohierf Sep 13, 2016
4ac7b6a
Improve configuration warnings/errors logging
mohierf Sep 13, 2016
4563860
Fix commit error
mohierf Sep 13, 2016
77e7158
Improve test and fix small error
mohierf Sep 13, 2016
ebab4a3
Fix pep8
mohierf Sep 13, 2016
6d49eb5
Fix pep8 / pylint
mohierf Sep 13, 2016
cf6b112
Improve AlignakTest class with methods to search in configuration logs
mohierf Sep 13, 2016
f47b54d
Improve test hostgroups
mohierf Sep 13, 2016
1150268
Adapt test for configuration
mohierf Sep 13, 2016
b1384ec
Fix pep8
mohierf Sep 13, 2016
ef09417
Fix pylint
mohierf Sep 13, 2016
3582866
Add tests for bad configuration
mohierf Sep 13, 2016
186b2f9
Fix pylint
mohierf Sep 13, 2016
b1cb3c5
Improve configuration test
mohierf Sep 13, 2016
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
235 changes: 226 additions & 9 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,10 +1,227 @@
Main developpers:

5c077yP <as@trademob.com>
Alexander Springer <alex.spri@gmail.com>
Alexander Springer <as@trademob.com>
Alexandre Boisvert <alexandre.boisvert.1@gmail.com>
Alexandre Viau <alexandre@alexandreviau.net>
Andreas Karfusehr <frescha@Elephant.(none)>
Andreas Karfusehr <frescha@unitedseed.de>
Andreas Paul <xorpaul@gmail.com>
Andrew McGilvray <amcgilvray@kixeye.com>
Andrus Viik <andrus@a7k.pri.ee>
Arthur Gautier <superbaloo+registrations.github@superbaloo.net>
Arthur Gautier <superbaloo@superbaloo.net>
Bruno Clermont <bruno.clermont@gmail.com>
Charlie Andrews <charlieandrews.cwa@gmail.com>
Charlie Root <root@shinken2.0>
Christian Posch <christian.posch@uibk.ac.at>
Christophe SIMON <christophe.simon@dailymotion.com>
Christophe Simon <geektophe@gmail.com>
Claneys Skyne <claneys.skyne@gmail.com>
DUVAL <electroni-k@hotmail.fr>
DUVAL Kévin <electroni-k@hotmail.fr>
Daniel Hokka Zakrisson <daniel@hozac.com>
Daniel Widerin <daniel@widerin.net>
Danijel Tasov <dt@korn.shell.la>
David Durieux <d.durieux@siprossii.com>



Contributors:



David GUENAUL <dguenault@monitoring-fr.org>
David GUENAULT <david.guenault@gmail.com>
David GUENAULT <dguenault@monitoring-fr.org>
David GUENAULT <yol@monitoring-fr.org>
David Gil <david.gil.marcos@gmail.com>
David Gil <dgil@a3sec.com>
David Laval <david@laval.me>
David Moreau Simard <dmsimard@iweb.com>
David- <david@actengo.com>
Davide Franco <bacula-dev@dflc.ch>
Davide Franco <dfranco@users.noreply.github.com>
Demelziraptor <demelza@circularvale.com>
Denetariko <denetariko@gmail.com>
Denis Sacchet <denis@rack42.fr>
Dessai.Imrane <dessai.imrane@gmail.com>
DessaiImrane <dessai.imrane@gmail.com>
Driskell <devel@jasonwoods.me.uk>
Durieux David <d.durieux@siprossii.com>
Eric Herot <eric.github@herot.com>
FORLOT Romain <rforlot@yahoo.com>
Florentin Raud <florentin.raud@gmail.com>
Forlot Romain <claneys.skyne@claneys.com>
Forlot Romain <rforlot@yahoo.com>
François Lafont <flafdivers@free.fr>
Fred MOHIER <frederic.mohier@ipmfrance.com>
Frescha <frescha@hydra.(none)>
Frescha <frescha@unitedseed.de>
FrogX <frogx@frogx-HP-625.(none)>
FrogX <frogx@frogx-System-Product-Name.(none)>
Frédéric MOHIER <frederic.mohier@gmail.com>
Frédéric MOHIER <frederic.mohier@ipmfrance.com>
Frédéric Pégé <fred@bbrose.net>
Frédéric Pégé <frederic.pege@devoteam.com>
Frédéric Pégé <frederic.pege@gmail.com>
Frédéric Vachon <fredvac@gmail.com>
GAULUPEAU Jonathan <jo.gaulupeau@gmail.com>
GAULUPEAU Jonathan <jonathan@gaulupeau.fr>
Gabes Jean <naparuba@users.sourceforge.net>
Gabès Jean <naparuba@gmail.com>
Gabès Jean <naparuba@users.sourceforge.net>
Gerhard Lausser <gerhard.lausser@consol.de>
Gerhard Lausser <lausser@shinken-monitoring.(none)>
Grégory Starck <g.starck@gmail.com>
Grégory Starck <greg@brutus.(none)>
Grégory Starck <gregory.starck@savoirfairelinux.com>
Guillaume Bour <guillaume.bour@uperto.com>
Guillaume Bour <guillaume@bour.cc>
H4wkmoon <frederic.pege@gmail.com>
H4wkmoon <frederic.pege@uperto.com>
Hannes Körber <hannes.koerber@gmail.com>
Hartmut Goebel <h.goebel@crazy-compilers.com>
Hartmut Goebel <h.goebel@goebel-consult.de>
Henry Bakker <henry@technoplunk.com>
Hermann.Lauer@iwr.uni-heidelberg.de <Hermann.Lauer@iwr.uni-heidelberg.de>
Httqm <fournet.matthieu@gmail.com>
Hubert <hubert.santuz@gmail.com>
Jan Ulferts <jan.ulferts@xing.com>
Jean <naparuba@users.sourceforge.net>
Jean Gabes <naparuba@gmail.com>
Jean Remond <cfengine@remond.re>
Jean-Charles <jean-charles.delon@matricscom.eu>
Jean-Claude Computing <jeanclaude.computing@gmail.com>
Jean-Maxime LEBLANC <jmax.leblanc@gmail.com>
Joaquim Roy <j.roy@shinken-solutions.com>
Johan Svensson <jsv@one.com>
John Hurliman <jhurliman@jhurliman.org>
Jonathan GAULUPEAU <jonathan@gaulupeau.com>
Konstantin Shalygin <k0ste@cn.ru>
Laurent Ollagnier <laurent.ollagnier@dunordausud.fr>
Laurent Ollagnier <laurent@xenbox.fr>
Litrin Jiang <litrin.jiang@intel.com>
Luke L <lukehasnoname@gmail.com>
Magnus Appelquist <magnus.appelquist@cloudnet.se>
Marc MAURICE <marc-github@pub.positon.org>
Mathias Fussenegger <f.mathias@zignar.net>
Mathieu MD <mathieu.md@gmail.com>
Mathieu Parent <math.parent@gmail.com>
Matthieu Caneill <matthieucan@users.noreply.github.com>
Michael Leinartas <mleinartas@gmail.com>
Mickael FALCK <lastmikoi@gmail.com>
Morkxy <morkxy@gmail.com>
Naparuba <naparuba@gmail.com>
Naparuba <naparuba@users.sourceforge.net>
Nicolas Brisac <nbrisac@oasiswork.fr>
Nicolas DUPEUX <nicolas.dupeux@arkea.com>
Nicolas DUPEUX <nicolas@dupeux.net>
Nicolas Dupeux <nicolas@dupeux.net>
Nicolas Limage <nlimage@online.net>
Nicolas Pichon <nicolas.pichon42@free.fr>
Olivier H <olivier.hanesse@gmail.com>
Olivier Hanesse <olivier.hanesse@gmail.com>
Olivier LI-KIANG-CHEONG <olikiang@phenix.(none)>
Pavel Volkovitskiy <olfway@gmail.com>
Peter Woodman <peter@shortbus.org>
Philippe Pepos Petitclerc <ppeposp@gmail.com>
Philippe Pépos Petitclerc <ppepos@users.noreply.github.com>
Pradeep Jindal <praddyjindal@gmail.com>
Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
Rich Trott <rtrott@gmail.com>
Robin Gloster <robin@loc-com.de>
Romain Forlot <rforlot@yahoo.com>
Romain LE DISEZ <romain.git@ledisez.net>
Romain LE DISEZ <romain.ledisez@ovh.net>
Romain THERRAT <romain42@gmail.com>
Ryan Davis <ryan@acceleration.net>
Rémi SAUVAT <remi.sauvat@inetprocess.com>
Samuel Milette-Lacombe <samuel.milette-lacombe@savoirfairelinux.com>
Sebastien Coavoux <Sebastien.Coavoux@nuance.com>
Sebastien Coavoux <alignak@pyseb.cx>
Sebastien Coavoux <s.coavoux@free.fr>
Sebastien Coavoux <sebastien.coavoux@savoirfairelinux.com>
Sismic <dmonnetbesson@gmail.com>
Sispheor <nico.marcq@gmail.com>
Socketubs <geoffrey@lehee.name>
Squiz <squiz@squiz.confais.org>
Steve Schnepp <steve.schnepp@pwkf.org>
Stéphane Duchesneau <stephane.duchesneau@savoirfairelinux.com>
Sylvain Boureau <s.boureau@shinken-solutions.com>
Sébastein Coavoux <s.coavoux@free.fr>
Sébastien <s.coavoux@free.fr>
Sébastien <sebastien.coavoux@savoirfairelinux.com>
Sébastien Coavoux <Seb-Solon@users.noreply.github.com>
Sébastien Coavoux <s.coavoux@free.fr>
S�bastien Coavoux <s.coavoux@free.fr>
The Gitter Badger <badger@gitter.im>
Thibault Cohen <thibault.cohen@savoirfairelinux.com>
Thibault Cohen <titilambert@gmail.com>
Thibautg16 <thibaut@tgillardeau.com>
Thomas Cellerier <thomas@thce-cryptzone.(none)>
Thomas Meson <zllak@hycik.org>
ThomasWaldmann <tw@waldmann-edv.de>
Tim Adam <tim@s3v.be>
Timo Veith <timo.veith@uni-tuebingen.de>
Valentin Brajon <vbrajon@gmail.com>
Victor Igumnov <victori@fabulously40.com>
Zoran Zaric <zz@zoranzaric.de>
andrewmcgilvray <a.mcgilvray@gmail.com>
anonimoose <anonimoose>
aurelien <aurelien.baudet@swid.fr>
aviau <alexandre.viau@savoirfairelinux.com>
baoboa <baobab874@gmail.com>
brightdroid <phpmyforum@gmail.com>
cedef <cedef@cassio.pe>
chris81 <christian.posch@gmail.com>
claneys <claneys.skyne@claneys.com>
colourmeamused <colourmeamused@noreply.com>
cyrilleJ <cyrjoss@yahoo.fr>
david hannequin <david.hannequin@gmail.com>
david-guenault <dguenault@monitoring-fr.org>
dhannequin <david.hannequin@fullsave.com>
fgth <fsoyer@systea.net>
fhoubart <florent.houbart@gmail.com>
flaf <flafdivers@free.fr>
foomip <nelsondcp@gmail.com>
frescha <frescha@unitedseed.de>
fsoyer <fsoyer@systea.net>
gmat <gmat2k@yahoo.fr>
h4wkmoon <frederic.pege@gmail.com>
hvad <david.hannequin@gmail.com>
itxx00 <itxx00@gmail.com>
jean-francois BUTKIEWICZ <jean-francois.butkiewicz@veosoft.net>
jfbutkiewicz <jean-francois.butkiewicz@veosoft.net>
jmartignago <j.martignago@mairie-villeneuvesurlot.fr>
jmcollongette <jean-michel.collongette@setra-conseil.com>
jogaulupeau <jo.gaulupeau@gmail.com>
k0ste <k0ste@cn.ru>
lafont <francois.lafont@crdp.ac-versailles.fr>
nagios <naparuba@gmail.com>
nagios <naparuba@users.sourceforge.net>
nap <naparuba@gmail.com>
nap <naparuba@users.sourceforge.net>
naparuba <naparuba@gmail.com>
naparuba <naparuba@users.sourceforge.net>
nerocide <jean.mich.c@gmail.com>
ning.xie <ning.xie@qunar.com>
odyssey4me <jesse.pretorius@gmail.com>
olivierHa <olivier.hanesse@gmail.com>
openglx <openglx@StarByte.net>
pydubreucq <pydubreucq@gmail.com>
raphaeltr <raphael.troiano@free.fr>
rasoso <rasoso@users.noreply.github.com>
root <root@centos-6-x86-64.(none)>
root <root@debian.capen.sis>
root <root@debian.localdomain>
root <root@debian6.(none)>
root <root@localhost.localdomain>
root <root@ubs-pc.(none)>
root <root@ubuntu.(none)>
shinken <naparuba@gmail.com>
shinken <naparuba@users.sourceforge.net>
smilingsubnode <florent.houbart@gmail.com>
spil-brensen <boris.rensen@spilgames.com>
system <system@ftp.monitoring-fr.org>
system <system@shinken.(none)>
system <system@ubuntu-11.04>
t0xicCode <xavier.l@t0xic.co.de>
t0xicCode <xavier@openconcept.ca>
thomascellerier <thomascellerier@gmail.com>
xkilian <fmikus@acktomic.com>
yam <yam+github@xenbox.fr>
yol <yol@kvm1085.iojo.net>
yol <yol@kvm613.iojo.net>
2 changes: 1 addition & 1 deletion alignak/daemons/arbiterdaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ def load_config_file(self): # pylint: disable=R0915
# The conf can be incorrect here if the cut into parts see errors like
# a realm with hosts and not schedulers for it
if not self.conf.conf_is_correct:
self.conf.show_errors()
err = "Configuration is incorrect, sorry, I bail out"
logger.error(err)
self.conf.show_errors()
sys.exit(err)

logger.info('Things look okay - No serious problems were detected '
Expand Down
42 changes: 15 additions & 27 deletions alignak/objects/checkmodulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
from alignak.objects.commandcallitem import CommandCallItems
from alignak.property import StringProp
from alignak.util import to_name_if_possible
from alignak.log import logger


class CheckModulation(Item):
Expand All @@ -76,7 +75,7 @@ class CheckModulation(Item):

running_properties = Item.running_properties.copy()

_special_properties = ('check_period',)
special_properties = ('check_period',)

macros = {}

Expand Down Expand Up @@ -120,49 +119,38 @@ def get_check_command(self, timeperiods, t_to_go):
return None

def is_correct(self):
"""Check if the CheckModulation definition is correct::
"""Check if this object configuration is correct ::

* Check for required attribute
* Raise previous configuration errors
* Check our own specific properties
* Call our parent class is_correct checker

:return: True if the definition is correct, False otherwise
:return: True if the configuration is correct, otherwise False
:rtype: bool
"""
state = True
cls = self.__class__

# Raised all previously saw errors like unknown commands or timeperiods
if self.configuration_errors != []:
state = False
for err in self.configuration_errors:
logger.error("[item::%s] %s", self.get_name(), err)

for prop, entry in cls.properties.items():
if prop not in cls._special_properties:
if not hasattr(self, prop) and entry.required:
logger.error("[checkmodulation::%s] %s property not set", self.get_name(),
prop)
state = False # Bad boy...

# Ok now we manage special cases...
# Service part
# Internal checks before executing inherited function...
if not hasattr(self, 'check_command'):
logger.error("[checkmodulation::%s] do not have any check_command defined",
self.get_name())
msg = "[checkmodulation::%s] do not have any check_command defined" % (
self.get_name()
)
self.configuration_errors.append(msg)
state = False
else:
if self.check_command is None:
logger.error("[checkmodulation::%s] a check_command is missing", self.get_name())
msg = "[checkmodulation::%s] a check_command is missing" % (self.get_name())
self.configuration_errors.append(msg)
state = False
if not self.check_command.is_valid():
logger.error("[checkmodulation::%s] a check_command is invalid", self.get_name())
msg = "[checkmodulation::%s] a check_command is invalid" % (self.get_name())
self.configuration_errors.append(msg)
state = False

# Ok just put None as check_period, means 24x7
if not hasattr(self, 'check_period'):
self.check_period = None

return state
return super(CheckModulation, self).is_correct() and state


class CheckModulations(CommandCallItems):
Expand Down
Loading