mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-10-31 20:23:36 +00:00 
			
		
		
		
	lib: improve normalize_text with another case
When normalizing a text also remove trailing whitespace since external tools might add them. This commit fixes a test failure in ospf_topo1 on Ubuntu 18.04.1. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
		
							parent
							
								
									fd8582906d
								
							
						
					
					
						commit
						9683a1bb50
					
				| @ -297,10 +297,16 @@ def get_file(content): | ||||
| 
 | ||||
| def normalize_text(text): | ||||
|     """ | ||||
|     Strips formating spaces/tabs and carriage returns. | ||||
|     Strips formating spaces/tabs, carriage returns and trailing whitespace. | ||||
|     """ | ||||
|     text = re.sub(r'[ \t]+', ' ', text) | ||||
|     text = re.sub(r'\r', '', text) | ||||
| 
 | ||||
|     # Remove whitespace in the middle of text. | ||||
|     text = re.sub(r'[ \t]+\n', '\n', text) | ||||
|     # Remove whitespace at the end of the text. | ||||
|     text = text.rstrip() | ||||
| 
 | ||||
|     return text | ||||
| 
 | ||||
| def module_present(module, load=True): | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rafael Zalamena
						Rafael Zalamena