]> Frank Brehm's Git Trees - my-stuff/nagios.git/commitdiff
Bugfixing, mit apply_tmplates() angefangen
authorFrank Brehm <frank@brehm-online.com>
Tue, 14 Dec 2010 21:53:58 +0000 (21:53 +0000)
committerFrank Brehm <frank@brehm-online.com>
Tue, 14 Dec 2010 21:53:58 +0000 (21:53 +0000)
git-svn-id: http://svn.brehm-online.com/svn/my-stuff/nagios/trunk@156 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa

bin/nagios/cfg/struct.py
bin/nagios/config.py

index 2053a208721fcdf9bebf7f2ff95f3ce657173079..686b6c4748fb2f17056382daa8165f94496446ce 100755 (executable)
@@ -461,7 +461,7 @@ returns None on failure"""
         re_timerange    = re_time + r'\s*-\s*' + re_time
         re_timeranges   = r'(' + re_timerange + r')(?:,(' + re_timerange + r'))*'
         re_weekdays     = r'(monday|tuesday|wednesday|thursday|friday|saturday|sunday)'
-        re_isodate      = r'(\d\d\d\d)-(0[1-9]|1[0-2])-([0-2][1-9]|3[01])'
+        re_isodate      = r'(\d\d\d\d)-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])'
         re_monthname    = r'(january|february|march|april|may|june|july|august|september|october|november|december)'
         re_monthname_wd = r'(day|january|february|march|april|may|june|july|august|september|october|november|december)'
 
index 79abfb7d47aa8877fe9850bd90a3e751d5a67e73..1fc6eaf4f2be588af5ee3c28cfdc5ba4ba2b7eb5 100644 (file)
@@ -315,16 +315,30 @@ class NagiosConfig(LoggingObject):
         for file_name in files:
             self.read_objectfile(file_name)
 
+        self.register_templates()
+        self.apply_tmplates()
+
         pp = pprint.PrettyPrinter( indent = 4, depth = 6, width = 120 )
         if self.verbose >= 3:
             self.logger.debug( "Read objects:\n{0}".format( pp.pformat( self.objects_read ) ) )
 
         del self.struct_verifier
 
-        self.register_templates()
-
         return
 
+    #------------------------------------------------------
+    def apply_tmplates( self ):
+        '''Apply definitions from templates (from 'use' declarations) into the object definitions in self.objects_read.
+        @return: None
+        @rtype: None
+        '''
+
+        pp = pprint.PrettyPrinter( indent = 4, depth = 6, width = 120 )
+        for object_type in self.objects_read:
+            for object in self.objects_read[object_type]:
+                object['templates'] = {}
+                object['templates_applied'] = set([])
+
     #------------------------------------------------------
     def register_templates( self ):
         '''Searches the self.objects_read structure, searches for templates and registers them in self.templates