@@ -24,23 +24,30 @@ def run(self, name, metadata):
2424 """Return dictionary with options for the group of instances."""
2525 options = self .config ().get ("options" )
2626 if not options :
27- self .log .warning ("'options' block not found in %s" , self .config ())
27+ self .log .warning ("%s: 'options' block not found in %s" , name , self .config ())
2828 return None
2929 if not isinstance (options , list ):
3030 self .log .warning (
31- "'options' block should be list of dictionaries in %s" , self .config (),
31+ "%s: 'options' block should be list of dictionaries in %s" ,
32+ name ,
33+ self .config (),
3234 )
3335 return None
3436 for group in self .config ().get ("options" , []):
3537 try :
36- self .log .debug ("Process group %s" , group )
38+ self .log .debug ("%s: Process group %s" , name , group )
3739 entry = group .get ("match" )
3840 if not entry :
39- self .log .warning ("Unable to find 'match' key in %s" , group )
41+ self .log .warning (
42+ "%s: Unable to find 'match' key in %s" , name , group ,
43+ )
4044 continue
4145 if ":" not in entry :
4246 self .log .warning (
43- "Unable to parse 'match' value %s for %s" , entry , group ,
47+ "%s: Unable to parse 'match' value %s for %s" ,
48+ name ,
49+ entry ,
50+ group ,
4451 )
4552 continue
4653 key , pattern = entry .split (":" , 1 )
@@ -50,18 +57,21 @@ def run(self, name, metadata):
5057 try :
5158 value = value .get (key_part )
5259 if not value :
53- self .log .debug ("Unable to find key %s" , key_part )
60+ self .log .debug ("%s: Unable to find key %s" , name , key_part )
5461 break
5562 except (AttributeError , NameError ):
56- self .log .debug ("Unable to find key %s" , key_part )
63+ self .log .debug ("%s: Unable to find key %s" , name , key_part )
5764 break
5865 if isinstance (value , str ) and regex .match (value ) is not None :
5966 self .log .debug (
60- "Match pattern %s and value %s" , pattern , value ,
67+ "%s: Pattern %s and value %s is matched" ,
68+ name ,
69+ pattern ,
70+ value ,
6171 )
6272 result = group .get (name )
6373 if result is not None :
6474 return result
6575 except AttributeError :
66- self .log .warning ("Unable to find 'match' key in %s" , group )
76+ self .log .warning ("%s: Unable to find 'match' key in %s" , name , group )
6777 return None
0 commit comments