Terracotta-OSS / terracotta-platform

http://terracotta.org
Apache License 2.0
32 stars 48 forks source link

TDB-5488 - fix set/unset license-file when unconfigured #1060

Closed tmesic99 closed 2 years ago

tmesic99 commented 2 years ago

Fix for defect: https://itrac.eur.ad.sag/browse/TDB-5488. This problem started after 10.7 fix 3, resulting from a change to when a server's config folders get created on disk (698072a0). With 10.7 fix 3 and earlier, config folders were created when the node was unconfigured . But this behavior was changed to only create the config folder structure as part of activation. This problem revealed itself when setting a license file on an unconfigured node with the server attempting to install the license into a non-existent folder throwing an exception (see TDB-5488).

The solution here holds the supplied 'licenseContent' string in memory, if set when unconfigured, until the node is activated. Upon activation, the existing licenseContent is then used to create the license on disk. Or, that in-memory license is superseded if the license is optionally supplied with the activate call.

Corresponding system tests will appear in a subsequent Enterprise PR.

tmesic99 commented 2 years ago

@mathieucarbou Yes, I had the exact same thoughts. I opted for the solution I implemented in this PR because it preserves the behavior that's always been present in dynamic config. That is, users have always been able to pre-configure their license before activation. But if you prefer to take the approach of altogether removing the ability to set/unset licenses from UNCONFIGURED nodes, then that's fine. Is that how you'd like to proceed?

mathieucarbou commented 2 years ago

@mathieucarbou Yes, I had the exact same thoughts. I opted for the solution I implemented in this PR because it preserves the behavior that's always been present in dynamic config. That is, users have always been able to pre-configure their license before activation. But if you prefer to take the approach of altogether removing the ability to set/unset licenses from UNCONFIGURED nodes, then that's fine. Is that how you'd like to proceed?

No, that's right... I have checked the code and saw that the set was allowed since a while... :-(

Let's fix it like that...