[type/__postgres_conf] Reverse state logic (decide based on source first)
This commit is contained in:
		
					parent
					
						
							
								bef1433ba3
							
						
					
				
			
			
				commit
				
					
						686e4f0f2d
					
				
			
		
					 1 changed files with 20 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -200,23 +200,24 @@ psql_exec 'SELECT 1' >/dev/null || {
 | 
			
		|||
	exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if psql_conf_cmp "${conf_name}" "$(cat "${__object:?}/parameter/value")"
 | 
			
		||||
then
 | 
			
		||||
	echo present
 | 
			
		||||
else
 | 
			
		||||
	case $(psql_conf_source "${conf_name}")
 | 
			
		||||
	in
 | 
			
		||||
case $(psql_conf_source "${conf_name}")
 | 
			
		||||
in
 | 
			
		||||
	('')
 | 
			
		||||
			# invalid configuration parameter
 | 
			
		||||
			# (error message was already printed by SHOW command above.
 | 
			
		||||
			#  Yes, it's a hack)
 | 
			
		||||
		printf 'Invalid configuration parameter: %s\n' "${conf_name}" >&2
 | 
			
		||||
		exit 1
 | 
			
		||||
		;;
 | 
			
		||||
	(default)
 | 
			
		||||
		echo absent
 | 
			
		||||
		;;
 | 
			
		||||
	(*)
 | 
			
		||||
		if ! test -f "${__object:?}/parameter/value"
 | 
			
		||||
		then
 | 
			
		||||
			echo present
 | 
			
		||||
		elif psql_conf_cmp "${conf_name}" "$(cat "${__object:?}/parameter/value")"
 | 
			
		||||
		then
 | 
			
		||||
			echo present
 | 
			
		||||
		else
 | 
			
		||||
			echo different
 | 
			
		||||
		fi
 | 
			
		||||
		;;
 | 
			
		||||
	esac
 | 
			
		||||
fi
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue