CASMCMS-8793: Update CFS import tool to add support for CFS sources #5548
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.
NOTE: This PR is against another PR branch, rather than the main release branch. That's because it modifies code that was changed in that other PR, so this was the simplest way to reduce merge conflict problems. Once the target PR branch merges, I'll rebase this one against the release branch. But it's ready for review as-is, because it'll be the same code changes.
CFS v3 introduced a new CFS object -- a source. The CFS export tool has already been updated to include them in the export data. This PR updates the import tool to include them in the imports, and also updated the associated documentation around CFS imports and exports.
Mostly the restore process for these is the same as for configurations, with a couple of caveats:
CFS sources refer to secrets that are stored in Vault. The CFS tools make no attempts to import/export or validate this Vault data. Part of this PR is to update the documentation to make this clear. There is existing documentation on how to backup and restore Vault, and that is now referenced by the CFS import/export docs.
CFS v3 originally provided no mechanism to restore a previously-created source. When creating a source in CFS v3, there was no way to specify the corresponding Vault secret. The idea is that you would pass in credentials when creating the source, and CFS would store those for you in Vault. But this doesn't help us in the import case, because our exports will never contain the credentials used to create the sources originally. The exports only contain the names of the Vault secrets that contain them. CASMCMS-9202 updated CFS v3 to allow for this kind of restore operation, where the Vault secret name was instead specified. This PR uses that new ability to do the restores. However, because this ability was only added in a particular CFS version, the import tooling has to check the CFS version before attempting those restores. So this PR contains logic to do that checking, and to inform the user in the case that the CFS version does not support source restores, but the exported data contains sources that need to be restored. In the case that the CFS version does not support restores, but the export data does not contain any sources that need to be restored (either because it has no sources at all, or because the sources it does have already exist in CFS), then the tool doesn't bug the user about it.
I have tested this on mug and verified that it works.
CSM 1.5 backport:
#5550