Closed Tiago-Anastacio closed 2 years ago
Hi, Dimitri
I face issue to catch correct return code from statement above (I forced an error creating a already existing formation but return code is 0 :
pgmonito@suvm-sles15-bac13:/.config/ansible_creation_flags> pg_autoctl create formation --formation appli1_sandbox --kind pgsql --dbname postgres --monitor postgres://autoctl_node@suvm-sles15-bac13.unix.sits.credit-agricole.fr:54320/pg_auto_failover?sslmode=verify-full&sslrootcert=/pgmonito/connexion/.tls/root.crt [1] 16480 pgmonito@suvm-sles15-bac13:/.config/ansible_creation_flags> 14:23:50 16480 ERROR Monitor ERROR: duplicate key value violates unique constraint "formation_pkey" 14:23:50 16480 ERROR Monitor DETAIL: Key (formationid)=(appli1_sandbox) already exists. 14:23:50 16480 ERROR Monitor CONTEXT: SQL statement "INSERT INTO pgautofailover.formation (formationid, kind, dbname, opt_secondary, number_sync_standbys) VALUES ($1, $2, $3, $4, $5)" 14:23:50 16480 ERROR SQL query: SELECT * FROM pgautofailover.create_formation($1, $2, $3, $4, $5) 14:23:50 16480 ERROR SQL params: 'appli1_sandbox', 'pgsql', 'postgres', 'true', '0' 14:23:50 16480 ERROR Failed to create formation "appli1_sandbox" of kind "pgsql", see previous lines for details. echo $? 0 [1]+ Exit 6 pg_autoctl create formation --formation appli1_sandbox --kind pgsql --dbname postgres --monitor postgres://autoctl_node@suvm-sles15-bac13.unix.sits.credit-agricole.fr:54320/pg_auto_failover?sslmode=verify-full pgmonito@suvm-sles15-bac13:~/.config/ansible_creation_flags>
Thank you
It looks like the monitor URI contains a special character that needs to be escaped from the shell, namely &, and you didn't quote the URI, so that the command is run in the background.
&
Hi, Dimitri
I face issue to catch correct return code from statement above (I forced an error creating a already existing formation but return code is 0 :
Thank you