Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
PDB 6.11.0
-
None
-
HA
-
Needs Assessment
-
Bug Fix
-
Previously (since 6.11.0) the status endpoint might return a status with an exception when it should have returned `false` for `write_db_up?`.
-
Needs Assessment
Description
When PuppetDB cannot connect to PostgreSQL, and a user queries /status/v1/services/puppetdb-status the status check throws an error instead of reporting that it cannot connect.
When PostgreSQL is running, and PuppetDB can connect, you should get a response like
{
|
"service_version": "6.11.2",
|
"service_status_version": 1,
|
"detail_level": "info",
|
"state": "running",
|
"status": {
|
"maintenance_mode?": false,
|
"queue_depth": 0,
|
"read_db_up?": true,
|
"write_db_up?": true,
|
"write_dbs_up?": true,
|
"write_db": {
|
"default": {
|
"up?": true
|
}
|
}
|
},
|
"active_alerts": [],
|
"service_name": "puppetdb-status"
|
}
|
When postgresql is not running we would expect
{
|
"service_version": "6.11.2",
|
"service_status_version": 1,
|
"detail_level": "info",
|
"state": "error",
|
"status": {
|
"maintenance_mode?": false,
|
"queue_depth": 0,
|
"read_db_up?": false,
|
"write_db_up?": false,
|
"write_dbs_up?": false,
|
"write_db": {
|
"default": {
|
"up?": false
|
}
|
}
|
},
|
"active_alerts": [],
|
"service_name": "puppetdb-status"
|
}
|
but what is actually returned is
{
|
"service_version": "6.11.2",
|
"service_status_version": 1,
|
"detail_level": "info",
|
"state": "unknown",
|
"status": "Status check for puppetdb-status threw an exception: clojure.lang.ExceptionInfo: Output of status-details does not match schema: \n\n\t \u001b[0;33m {:write_db_up? (not (instance? java.lang.Boolean nil))} \u001b[0m \n\n {:type :schema.core/error, :schema {:maintenance_mode? java.lang.Boolean, :queue_depth (maybe Int), :read_db_up? java.lang.Boolean, :write_db_up? java.lang.Boolean, :write_dbs_up? java.lang.Boolean, :write_db {java.lang.String {:up? java.lang.Boolean}}}, :value {:maintenance_mode? false, :queue_depth 0, :read_db_up? false, :write_db_up? nil, :write_dbs_up? false, :write_db {\"default\" {:up? false}}}, :error {:write_db_up? (not (instance? java.lang.Boolean nil))}}",
|
"active_alerts": [],
|
"service_name": "puppetdb-status"
|
}
|
Once PuppetDB can connect to postgres again the status endpoint will return the expected response.