this is the start of porting update-remove-index, which currently
doesn't work for a host of reasons.
We should probably remove the syntax of &list -= &attr, as it is
now duplicative, and we don't like that.
*
* The we just apply the assignment to the LHS, over-writing it's value.
*/
- if ((map->op == T_OP_SET) && (tmpl_attr_tail_num(current->lhs.vpt) == NUM_UNSPEC)) {
+ if ((map->op == T_OP_SET) && ((tmpl_attr_tail_num(current->lhs.vpt) == NUM_UNSPEC) || !current->map->rhs)) {
tmpl_dcursor_ctx_t cc;
fr_dcursor_t cursor;
bool first = fr_type_is_structural(tmpl_attr_tail_da(current->lhs.vpt)->type);
*
* because foo[3] is a single leaf value, not a list.
*/
- if (!map->rhs && fr_type_is_leaf(tmpl_attr_tail_da(current->lhs.vpt)->type)) {
+ if (!map->rhs && fr_type_is_leaf(tmpl_attr_tail_da(current->lhs.vpt)->type) &&
+ (map_list_num_elements(&map->child) > 0)) {
RWDEBUG("Cannot set one entry to multiple values for %s", current->lhs.vpt->name);
return -1;
}
--- /dev/null
+#
+# PRE: if edit
+#
+&request += {
+ &Tmp-IP-Address-0 = 192.0.2.1
+ &Tmp-IP-Address-0 = 192.0.2.2
+}
+
+#
+# Delete only the second one
+#
+&request.Tmp-IP-Address-0[1] := {}
+
+#
+# Attribute 'Tmp-IP-Address[1]' not found.
+#
+#&request -= &Tmp-IP-Address[1]
+
+if (&Tmp-IP-Address-0[#] != 1) {
+ test_fail
+}
+
+if !(&Tmp-IP-Address-0[0] == 192.0.2.1) {
+ test_fail
+}
+
+success