Skip to content

update discovery backup restore script version to 5.4.0#286

Open
furu1san wants to merge 1 commit into
watson-developer-cloud:masterfrom
furu1san:wd540-br
Open

update discovery backup restore script version to 5.4.0#286
furu1san wants to merge 1 commit into
watson-developer-cloud:masterfrom
furu1san:wd540-br

Conversation

@furu1san

Copy link
Copy Markdown

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_token function is added, allowing users to authenticate via CP4D_USERNAME and CP4D_PASSWORD environment variables instead of relying solely on the internal service token mechanism. Additionally, the fetch_cmd_result function 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 from 5.3.1 to 5.4.0.

Files Changed

📄 discovery-data/latest/lib/function.bash

  • fetch_cmd_result improvement: Updated to capture stderr alongside stdout (2>&1) and check the exit code of oc exec rather 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.
  • New get_cp4d_user_token function: Retrieves a CP4D access token by calling the /v1/preauth/validateAuth endpoint using CP4D_USERNAME and CP4D_PASSWORD credentials 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 use get_cp4d_user_token when CP4D_USERNAME and CP4D_PASSWORD are 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 or null.
  • create_restore_instance_mappings: Same CP4D user token fallback logic and token validation added, with return 1 on failure instead of exit 1 to allow graceful error handling.
  • check_instance_mappings: Same CP4D user token fallback logic and token validation added with return 1 on failure.
  • check_instance_exists: Same CP4D user token fallback logic and token validation added with return 1 on failure.
  • create_service_instance: Same CP4D user token fallback logic and token validation added with return 1 on failure.

📄 discovery-data/latest/version.txt

Bumped the Backup and Restore Scripts version from 5.3.1 to 5.4.0 so that they support discovery 5.4.0.

@furu1san

Copy link
Copy Markdown
Author

@kvineetnair Could you please review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant