@@ -498,29 +498,27 @@ def to_intermediate(self):
498498 # determine extra packages used
499499 extra_packages = {}
500500 for key , value in self .netjson .items ():
501- if key not in ignore_list :
502- block_list = []
503- # sort each config block
504- if isinstance (value , list ):
505- i = 1
506- for block in value [:]:
507- # config block must be a dict
508- # with a key named "config_name"
509- # otherwise it's skipped with a warning
510- if not isinstance (block , dict ) or 'config_name' not in block :
511- json_block = json .dumps (block , indent = 4 )
512- print ('Unrecognized config block was skipped:\n \n '
513- '{0}\n \n ' .format (json_block ))
514- continue
515- block ['.type' ] = block .pop ('config_name' )
516- block ['.name' ] = block .pop ('config_value' ,
517- '{0}_{1}' .format (block ['.type' ], i ))
518- block_list .append (sorted_dict (block ))
519- i += 1
520- # if not a list just skip
521- else : # pragma: nocover
501+ # skip blocks present in ignore_list
502+ # or blocks not represented by lists
503+ if key in ignore_list or not isinstance (value , list ):
504+ continue
505+ block_list = []
506+ # sort each config block
507+ i = 1
508+ for block in value [:]:
509+ # config block must be a dict
510+ # with a key named "config_name"
511+ # otherwise it's skipped with a warning
512+ if not isinstance (block , dict ) or 'config_name' not in block :
513+ json_block = json .dumps (block , indent = 4 )
514+ print ('Unrecognized config block was skipped:\n \n '
515+ '{0}\n \n ' .format (json_block ))
522516 continue
523- extra_packages [key ] = block_list
517+ block ['.type' ] = block .pop ('config_name' )
518+ block ['.name' ] = block .pop ('config_value' , '{0}_{1}' .format (block ['.type' ], i ))
519+ block_list .append (sorted_dict (block ))
520+ i += 1
521+ extra_packages [key ] = block_list
524522 if extra_packages :
525523 return sorted_dict (extra_packages ).items ()
526524 # return empty tuple if no extra packages are used
0 commit comments