refactor(bbb-config): More robust updates of recordings' "metadata.xml" when issuing "bbb-conf --setip" #12682
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
"bbb-conf --setip " updates a lot of configuration files. Among other things, it also updates the "metadata.xml" files of recordings in order to have URLs pointing to the new hostname. The primarily used "sed" commands did not touch URLs when linebreaks have been between the opening XML tags and the URLs themselves or when the XML attributes are in a different order.
The PR should fix this by using "xmlstarlet" which has been already used by "bbb-conf" for other changes/updates.
Closes Issue(s)
Closes #12628
Motivation
Altering XML files with a line-based stream editor (like "sed") is not a good idea in general. It is always prone to exceptions to the pattern a programmer has in mind. Especially, the XML files for rather old recordings might have been generated by scripts that have been exchanged for years. Nobody thinks about them. Therefore, we need a robust mechanism to update the URLs. Of course, "sed" could be tweaked to parse patterns across multiple lines, but it still remains a fragile construct, e.g., when the format of "metadata.xml" might be updated in th future.