update discovery backup restore script version to 5.4.0#286
Open
furu1san wants to merge 1 commit into
Open
Conversation
Author
|
@kvineetnair Could you please review this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This pull request introduces CP4D user token authentication as an alternative to the internal Zen Core service token for backup/restore operations. A new
get_cp4d_user_tokenfunction is added, allowing users to authenticate viaCP4D_USERNAMEandCP4D_PASSWORDenvironment variables instead of relying solely on the internal service token mechanism. Additionally, thefetch_cmd_resultfunction is improved to detect command failures via exit codes rather than empty output, and robust token validation is added across all affected functions. The scripts version is bumped from5.3.1to5.4.0.Files Changed
📄
discovery-data/latest/lib/function.bashfetch_cmd_resultimprovement: Updated to capture stderr alongside stdout (2>&1) and check the exit code ofoc execrather than relying on empty output to detect failures. Error messages are updated to better reflect the actual failure condition (command execution failure vs. empty result). Commands that succeed but return empty output are now handled correctly.get_cp4d_user_tokenfunction: Retrieves a CP4D access token by calling the/v1/preauth/validateAuthendpoint usingCP4D_USERNAMEandCP4D_PASSWORDcredentials via the CP4D route. This provides an external authentication path as an alternative to the internal Zen Core service token.create_backup_instance_mappings: Updated to useget_cp4d_user_tokenwhenCP4D_USERNAMEandCP4D_PASSWORDare set, falling back to the internal Zen Core token otherwise. Added token validation with a clear error message and early exit if the token is missing ornull.create_restore_instance_mappings: Same CP4D user token fallback logic and token validation added, withreturn 1on failure instead ofexit 1to allow graceful error handling.check_instance_mappings: Same CP4D user token fallback logic and token validation added withreturn 1on failure.check_instance_exists: Same CP4D user token fallback logic and token validation added withreturn 1on failure.create_service_instance: Same CP4D user token fallback logic and token validation added withreturn 1on failure.📄
discovery-data/latest/version.txtBumped the Backup and Restore Scripts version from
5.3.1to5.4.0so that they support discovery 5.4.0.