Changeset 666


Ignore:
Timestamp:
09/04/12 15:59:34 (9 years ago)
Author:
ramonb
Message:
  • first attempt at 'include file aware' gmond.conf parsing in search of GMETRIC_TARGET
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jobmond/jobmond.py

    r665 r666  
    2525import xdrlib, socket, syslog, xml, xml.sax
    2626from types import *
     27from glob import glob
    2728
    2829VERSION='TRUNK+SVN'
     
    9798    def __init__( self, config_file ):
    9899
    99         self.config_file    = config_file
     100        self.config_file     = config_file
     101        self.include_parsers = [ ]
    100102
    101103        if not os.path.exists( self.config_file ):
     
    103105            debug_msg( 0, "FATAL ERROR: gmond config '" + self.config_file + "' not found!" )
    104106            sys.exit( 1 )
     107
     108    def removeHaakjes( self, value ):
     109
     110        clean_value = value
     111        clean_value = clean_value.replace( "(", "" )
     112        clean_value = clean_value.replace( ")", "" )
     113        clean_value = clean_value.strip()
     114
     115        return clean_value
    105116
    106117    def removeQuotes( self, value ):
     
    156167
    157168                continue
     169
     170            if line.find( 'include' ) != -1:
     171
     172                line = line.removeHaakjes()
     173
     174                include_line  = line.strip(' ')[1:]
     175
     176                for include_file in glob( include_line ):
     177
     178                    include_parser = GangliaConfigParser( include_file )
     179                    include_getval = include_parser.getStr( section, valname )
     180
     181                    if include_getval:
     182
     183                        value = include_getval
     184                        #break ? FIXME value can be overriden by other includes: perhaps users problem
     185
     186                    del include_parser
    158187
    159188            if line.find( section ) != -1:
Note: See TracChangeset for help on using the changeset viewer.