Bug 6122 - tl-config can't delete any configuration
Summary: tl-config can't delete any configuration
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Other (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: MediumPrio
Assignee: Peter Åstrand
Depends on:
Reported: 2017-01-09 10:00 CET by Karl Mikaelsson
Modified: 2020-10-22 17:04 CEST (History)
2 users (show)

See Also:
Acceptance Criteria:

Patch that adds a delete parameter option to hivetool (2.99 KB, patch)
2018-05-31 09:17 CEST, Samuel Mannehed

Description Karl Mikaelsson cendio 2017-01-09 10:00:58 CET
If you use tl-config as your interface to the ThinLinc configuration, you are unable to remove configuration parameters. You should be able to remove configuration parameters as easy as you can add them.
Comment 2 Samuel Mannehed cendio 2018-05-31 09:17:26 CEST
Created attachment 868 [details]
Patch that adds a delete parameter option to hivetool

Note that we might want to add a confirmation and a "-force" flag to this as well.
Comment 3 Linn cendio 2020-10-15 15:48:49 CEST
Looking at subclusters and profiles we can see that not only parameters are subject to modification from the administrator, but also entire sections.

An admin can add a new section using tl-config, that means he should also be able to remove it.

Note that the attached patch only handles deleting parameters, and not sections.
Comment 4 Linn cendio 2020-10-15 16:05:39 CEST
There is code in hiveconf that is meant to be able to delete sections but it doesn't work very well. Sections are what hiveconf writes to file for the data-structure called "Folder". If we have the section [/A/B] that means we have a folder A, with a subfolder B.

Currently if Folder.delete() is called, in the .hconf file it will remove the section-line AND one additional line, no matter what that next line contains.

If you have the following content in your .hconf:

 p1 = val1

 p2 = val2

and call delete() on the folder "B" the result will be that the folder "C" will also get removed, and the parameter "p2" will now belong to the folder "A".

We added a FIXME for this in the offending code. This is not trivial to fix however, since it's not clear what the expected behaviour should be.

When parsing the configuration all Parameters belong to a Folder. That causes me to think that when removing a Folder or a "section", all the Parameters, and possibly all the subfolders, should be removed as well. So a Folder.delete() would result in removing all lines in between that section in the file, and the next section (or the end of file).

With the above line of thinking we run into some complications:

 * How do we handle comments? The rest of the code never modifies any comments. The admin could also have a comment regarding the section ABOVE the section itself.
 * What should happen if a section exists in multiple files?

Perhaps the best path forward would be that Folder.delete() causes the section to be commented-out.

Note You need to log in before you can comment on or make changes to this bug.