Opened 20 months ago

Last modified 18 months ago

#5128 accepted enhancement

handle two (or more) occurrences of the same parameter

Reported by: fdupont Owned by: fdupont
Priority: low Milestone: Outstanding Tasks
Component: remote-management Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets: #5037
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

Currently when a parameter of a map is parsed the bison action:

  • create a value
  • put it into the map using MapElement::set("name", value

so if the configuration has twice the same parameter name in the same map the value is overwritten by the last value.
It is easy to protect against this in the grammar by:

  • call a check function which raises an error
  • call a check function which emits a warning
  • add some code to merge values (for a map or a a list simply reuse the previous value).

I prefer the first as in general it is really a bug in the config. Note with the file include users have an safe way to extend a map or a list.

Subtickets

Change History (7)

comment:1 follow-up: Changed 20 months ago by tomek

Yes, I prefer an error, too. The easiest way to go would be to implement a function checkAndAdd or similar. If would call find() first and throw if the name is present already.

comment:2 in reply to: ↑ 1 Changed 20 months ago by fdupont

Replying to tomek:

Yes, I prefer an error, too. The easiest way to go would be to implement a function checkAndAdd or similar. If would call find() first and throw if the name is present already.

=> yes (with find() / contains() as it works on Elements). I'll do it if it is adopted to 1.2 next week (and if it is not I recommend 1.3)

comment:3 Changed 19 months ago by hschempf

  • Milestone changed from Kea-proposed to Kea1.2

Per Kea meeting Feb 16, accept 1.2 low

comment:4 Changed 19 months ago by fdupont

  • Owner set to fdupont
  • Status changed from new to accepted

I shall do it when nothing with any kind of higher priority will be available.

comment:5 Changed 19 months ago by fdupont

Waiting for other syntax changing tickets to be merged (#3389, #5061, #5073, #5121 and #5124).

comment:6 Changed 18 months ago by tomek

  • Milestone changed from Kea1.2 to Kea1.2-final

Code freeze for 1.2-beta. Moving all remaining open tickets to 1.2-final.

comment:7 Changed 18 months ago by tomek

  • Milestone changed from Kea1.2-final to Outstanding Tasks

As discussed on 2017-04-13 call, moving to outstanding.

Note: See TracTickets for help on using tickets.