Getting the special entries added.
This commit is contained in:
		
							parent
							
								
									948e4eede5
								
							
						
					
					
						commit
						8fb48f7225
					
				| @ -11,24 +11,30 @@ | ||||
|     default=keepalived_defaults, | ||||
|     merge=True) -%} | ||||
| 
 | ||||
| {%- macro config_entries(data, indents) -%} | ||||
| {%- set groupings = ['vrrp_script', 'vrrp_sync_group', 'vrrp_instance',  | ||||
|     'virtual_server_group', 'virtual_server', 'real_server'] -%} | ||||
| {%- macro config_entries(data, indents, carryover='') -%} | ||||
|   {%- if data is string or data is number -%} | ||||
| {{ data|string|indent(indents, True) }}{{ '\n' }} | ||||
|   {%- else -%} | ||||
|     {%- if indents != 0 -%} | ||||
|     {%- if indents != 0 and not carryover -%} | ||||
| {{- "{\n" -}} | ||||
|     {%- endif -%} | ||||
|     {%- if data is mapping -%} | ||||
|       {%- for entry in data|dictsort -%} | ||||
|         {%- if entry[0] in groupings -%} | ||||
| {{- config_entries(entry[1], indents + 2, carryover=entry[0]) -}} | ||||
|         {%- else -%} | ||||
| {{ entry[0]|indent(indents, True) }} | ||||
| {{- config_entries(entry[1], indents + 2) -}} | ||||
|         {%- endif -%} | ||||
|       {%- endfor -%} | ||||
|     {%- else -%} | ||||
|       {%- for entry in data -%} | ||||
| {{- config_entries(entry, indents) -}} | ||||
|       {%- endfor -%} | ||||
|     {%- endif -%} | ||||
|     {%- if indents != 0 -%} | ||||
|     {%- if indents != 0 and not carryover -%} | ||||
| {{ '}'|indent(indents - 2, True) }}{{ '\n' }} | ||||
|     {%- endif -%} | ||||
|   {%- endif -%} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jeff Baskin
						Jeff Baskin