From: Sebastian Harl Date: Mon, 3 Nov 2014 06:28:28 +0000 (+0100) Subject: frontend: Let FETCH apply filters to the host as well. X-Git-Tag: sysdb-0.6.0~39 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6efa08926a3f15b38dd008198680a60c80a5fc63;p=sysdb.git frontend: Let FETCH apply filters to the host as well. --- diff --git a/src/frontend/query.c b/src/frontend/query.c index 1cb32dd..e9c2d22 100644 --- a/src/frontend/query.c +++ b/src/frontend/query.c @@ -273,7 +273,8 @@ sdb_fe_exec_fetch(sdb_conn_t *conn, int type, const char *name, } host = sdb_store_get_host(name); - if (! host) { + if ((! host) || (filter + && (! sdb_store_matcher_matches(filter, host, NULL)))) { sdb_log(SDB_LOG_DEBUG, "frontend: Failed to fetch host '%s': " "not found", name); diff --git a/t/integration/query.sh b/t/integration/query.sh index e034e7c..39522cf 100755 --- a/t/integration/query.sh +++ b/t/integration/query.sh @@ -93,6 +93,11 @@ echo "$output" | grep -F 'localhost' && exit 1 echo "$output" | grep -F 'other.host.name' && exit 1 echo "$output" | grep -F 'some.host.name' && exit 1 +output="$( run_sysdb -H "$SOCKET_FILE" \ + -c "FETCH host 'host1.example.com' FILTER last_update < 0" )" \ + && exit 1 +echo "$output" | grep -F 'not found' + (echo 'LIST hosts;'; sleep 1; echo "FETCH host 'host1.example.com'") \ | run_sysdb -H "$SOCKET_FILE"