diff --git a/src/core/store.c b/src/core/store.c
index 95aaafad9a46b370c17d0aec0e885bbb66843e1f..ed5b7ceb5095c683bdb2a3c775c67ff389950ff7 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
/*
* SysDB - src/core/store.c
- * Copyright (C) 2012 Sebastian 'tokkee' Harl <sh@tokkee.org>
+ * Copyright (C) 2012-2013 Sebastian 'tokkee' Harl <sh@tokkee.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "sysdb.h"
#include "core/store.h"
-#include "core/error.h"
#include "core/plugin.h"
+#include "utils/error.h"
#include "utils/llist.h"
#include <assert.h>
return sobj;
}
+ /* don't lookups non-host types from hierarchical hosts */
+ if ((type != SDB_HOST) && (sobj->type == SDB_HOST))
+ continue;
+
sobj = sdb_store_lookup_in_list(sobj->children, type, name);
if (sobj) {
sdb_llist_iter_destroy(iter);
parent_list = parent->children;
}
- /* TODO: only look into direct children? */
if (type == SDB_HOST)
/* make sure that each host is unique */
old = STORE_OBJ(sdb_store_lookup_in_list(obj_list, type, name));
else if (type == SDB_ATTRIBUTE)
+ /* look into attributes of this host */
old = STORE_OBJ(sdb_llist_search_by_name(parent_list, name));
else
+ /* look into services assigned to this host (sdb_store_lookup_in_list
+ * does not look up services from hierarchical hosts) */
old = STORE_OBJ(sdb_store_lookup_in_list(parent_list, type, name));
if (old) {
}
sdb_llist_iter_destroy(svc_iter);
- sdb_strbuf_append(buf, "]}");
+ sdb_strbuf_append(buf, "]},");
}
sdb_strbuf_append(buf, "]}");