forked from ungleich-public/cdist
		
	[type/__postgres_conf] Catch connection errors early
This commit is contained in:
		
					parent
					
						
							
								f9ebb4333c
							
						
					
				
			
			
				commit
				
					
						6b18cace75
					
				
			
		
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -37,6 +37,11 @@ esac
 | 
			
		|||
 | 
			
		||||
conf_name=${__object_id:?}
 | 
			
		||||
 | 
			
		||||
su - "${postgres_user}" -c 'psql postgres -c "SELECT 1"' >/dev/null || {
 | 
			
		||||
	echo 'Connection to PostgreSQL server failed' >&2
 | 
			
		||||
	exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if su - "${postgres_user}" -c "psql postgres -twAc 'SHOW ${conf_name}'" \
 | 
			
		||||
	| cmp -s "${__object:?}/parameter/value" -
 | 
			
		||||
then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue