Opened 2 years ago

Closed 9 months ago

#3998 closed defect (complete)

Extend configuration file processing to handle missing elements

Reported by: stephen Owned by: tomek
Priority: low Milestone: Kea1.2
Component: remote-management Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
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 (last modified by tomek)

This ticket has been created as a result of #3952. If an element is absent from a configuration file, its parser is not called. This is a problem for some elements when the system is reconfigured.

The particular case referred to in #3952 is the "hooks-libraries" element. Processing this element causes a persistent change of state to Kea, i.e. that the parser causes the dynamic libraries to be loaded and unloaded. If libraries are loaded and "hooks-libraries" is removed from the configuration, although no hooks libraries are now specified the parser is not called, and so the currently-loaded libraries are not unloaded.

There is a workaround: ensure that "hooks-libraries" is retained in the configuration file, specifying an empty set of libraries. However, this is error prone and violates the assumption that elements not required for configuration do not have to be present in the file. It is also error-prone - no message is output about the lack of an element, so the user may think that the libraries have been unloaded when in fact they haven't.

It is suggested that the file processing be modified to cope with this case. Two possible solutions are:

  1. Make such elements mandatory in the configuration file, requiring that a default value (in the case of hooks-libraries, an empty list) be supplied. If a mandatory element is not supplied, an error is generated.
  2. Have the code keep track of parsers called. At the end of processing a configuration file, call unused parsers with a flag indicating that the element was not present and allow the parser to take what action it requires.

Subtickets

Change History (8)

comment:1 Changed 2 years ago by hschempf

  • Milestone changed from Kea-proposed to DHCP Outstanding Tasks

per team meeting on 26 Aug, move to outstanding

comment:2 Changed 2 years ago by tomek

  • Milestone changed from DHCP Outstanding Tasks to Outstanding Tasks

Milestone renamed

comment:3 Changed 15 months ago by tomek

  • Description modified (diff)
  • Milestone changed from Outstanding Tasks to Kea1.2

comment:4 Changed 13 months ago by tomek

  • Component changed from configuration to remote-management

comment:5 Changed 11 months ago by fdupont

In fact another ticket dependent on parser refactoring...

comment:6 Changed 10 months ago by fdupont

Funny but I believe some of this issue (but not hooks-libraries?) are still there.

comment:7 Changed 9 months ago by tomek

  • Owner set to tomek
  • Status changed from new to assigned

This is no longer relevant. The parsers were significantly refactored (many parts of the code rewritten). As a result, we have default values for fields. Also, we can act on elements that are not in the config file. In particular, the hooks action to unload and load again libraries is conducted every time, even if the new config does not have hooks-libraries entry.

comment:8 Changed 9 months ago by tomek

  • Resolution set to complete
  • Status changed from assigned to closed

There's nothing else to do here, closing ticket.

Note: See TracTickets for help on using tickets.