From: Sebastian Harl Date: Wed, 20 Feb 2013 21:52:38 +0000 (+0100) Subject: puppet-storeconfigs backend: Check database connection in collect callback. X-Git-Tag: sysdb-0.1.0~439 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=939bfe506b177cab5867a3a389d44a744802f77b;p=sysdb.git puppet-storeconfigs backend: Check database connection in collect callback. --- diff --git a/src/backend/puppet-storeconfigs.c b/src/backend/puppet-storeconfigs.c index 1129a5a..f033808 100644 --- a/src/backend/puppet-storeconfigs.c +++ b/src/backend/puppet-storeconfigs.c @@ -150,6 +150,12 @@ sdb_puppet_stcfg_collect(sdb_object_t *user_data) return -1; client = SDB_OBJ_WRAPPER(user_data)->data; + if (sdb_dbi_client_check_conn(client)) { + fprintf(stderr, "puppet storeconfigs backend: " + "Connection to storeconfigs DB failed.\n"); + return -1; + } + if (sdb_dbi_exec_query(client, "SELECT name, updated_at FROM hosts;", sdb_puppet_stcfg_get_hosts, NULL, /* #columns = */ 2, /* col types = */ SDB_TYPE_STRING, SDB_TYPE_DATETIME)) {