Exemplo n.º 1
0
 def _get_service_macro(self,macroname):
     # TODO: This function is incomplete and untested
     if macroname.startswith('$_SERVICE'):
         'If this is a custom macro'
         name = macroname[9:-1]
         return self["_%s" % name]
     if _standard_macros.has_key( macroname ):
         attr = _standard_macros[ macroname ]
         return self[ attr ]
     return ''
Exemplo n.º 2
0
 def _get_host_macro(self, macroname, host_name=None):
     # TODO: This function is incomplete and untested
     if macroname.startswith('$_HOST'):
         'if this is a custom macro'
         name = macroname[6:-1]
         return self["_%s" % name]
     if _standard_macros.has_key( macroname ):
         attr = _standard_macros[ macroname ]
         return self[ attr ]
     return ''
Exemplo n.º 3
0
 def get_macro(self, macroname, host_name=None ):
     # TODO: This function is incomplete and untested
     if macroname.startswith('$ARG'):
         'Command macros handled in a special function'
         return self._get_command_macro(macroname)
     if macroname.startswith('$USER'):
         '$USERx$ macros are supposed to be private, but we will display them anyway'
         for mac,val in config.resource_values:
             if macroname == mac:
                 return val
         return ''
     if macroname.startswith('$HOST') or macroname.startswith('$_HOST'):
         return self._get_host_macro(macroname, host_name=host_name)
     if macroname.startswith('$SERVICE') or macroname.startswith('$_SERVICE'):
         return self._get_service_macro(macroname)
     if _standard_macros.has_key( macroname ):
         attr = _standard_macros[ macroname ]
         return self[ attr ]
     return ''