Ignore defaults.hjson values if already set (#19511)
* Ignore defaults.hjson values if already set * Add warning when nothing is merged
This commit is contained in:
		
							parent
							
								
									403c7eeb5c
								
							
						
					
					
						commit
						974a1eaf2a
					
				
					 3 changed files with 12 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -561,8 +561,16 @@ def _process_defaults(info_data):
 | 
			
		|||
    for default_type in defaults_map.keys():
 | 
			
		||||
        thing_map = defaults_map[default_type]
 | 
			
		||||
        if default_type in info_data:
 | 
			
		||||
            for key, value in thing_map.get(info_data[default_type], {}).items():
 | 
			
		||||
                info_data[key] = value
 | 
			
		||||
            merged_count = 0
 | 
			
		||||
            thing_items = thing_map.get(info_data[default_type], {}).items()
 | 
			
		||||
            for key, value in thing_items:
 | 
			
		||||
                if key not in info_data:
 | 
			
		||||
                    info_data[key] = value
 | 
			
		||||
                    merged_count += 1
 | 
			
		||||
 | 
			
		||||
            if merged_count == 0 and len(thing_items) > 0:
 | 
			
		||||
                _log_warning(info_data, 'All defaults for \'%s\' were skipped, potential redundant config or misconfiguration detected' % (default_type))
 | 
			
		||||
 | 
			
		||||
    return info_data
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue