<s> """<STR_LIT>""" <EOL> import nova . conf <EOL> from oslo_log import log as logging <EOL> from stevedore import enabled <EOL> from nova . i18n import _LW <EOL> CONF = nova . conf . CONF <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class MonitorHandler ( object ) : <EOL> NAMESPACES = [ <EOL> '<STR_LIT>' , <EOL> ] <EOL> def __init__ ( self , resource_tracker ) : <EOL> self . type_monitor_loaded = { ns : False for ns in self . NAMESPACES } <EOL> self . monitors = [ ] <EOL> for ns in self . NAMESPACES : <EOL> plugin_mgr = enabled . EnabledExtensionManager ( <EOL> namespace = ns , <EOL> invoke_on_load = True , <EOL> check_func = self . check_enabled_monitor , <EOL> invoke_args = ( resource_tracker , ) <EOL> ) <EOL> self . monitors += [ ext . obj for ext in plugin_mgr ] <EOL> def check_enabled_monitor ( self , ext ) : <EOL> """<STR_LIT>""" <EOL> ept = ext . entry_point_target <EOL> ept_parts = ept . split ( '<STR_LIT::>' ) <EOL> namespace_parts = ept_parts [ <NUM_LIT:0> ] . split ( '<STR_LIT:.>' ) <EOL> namespace = '<STR_LIT:.>' . join ( namespace_parts [ <NUM_LIT:0> : - <NUM_LIT:1> ] ) <EOL> if self . type_monitor_loaded [ namespace ] is not False : <EOL> LOG . warning ( _LW ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> { '<STR_LIT>' : namespace , <EOL> '<STR_LIT>' : ext . name , <EOL> '<STR_LIT>' : self . type_monitor_loaded [ namespace ] <EOL> } ) <EOL> return False <EOL> cfg_monitors = [ '<STR_LIT>' + cfg if '<STR_LIT:.>' not in cfg else cfg <EOL> for cfg in CONF . compute_monitors ] <EOL> cfg_monitors = [ '<STR_LIT>' + cfg <EOL> if '<STR_LIT>' not in cfg else cfg <EOL> for cfg in cfg_monitors ] <EOL> if namespace + '<STR_LIT:.>' + ext . name in cfg_monitors : <EOL> self . type_monitor_loaded [ namespace ] = ext . name <EOL> return True <EOL> LOG . warning ( _LW ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> { '<STR_LIT>' : namespace , '<STR_LIT>' : ext . name } ) <EOL> return False </s>
