Skip to content

Commit

Permalink
Issue #4181 - Bug: Output log for agent uninstall needs better clarity
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandra Chyła <aleksandra.chyla@ibm.com>
  • Loading branch information
Aleksandra Chyła authored and LiilyZhang committed Dec 13, 2024
1 parent 714369e commit b9b6e0a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions agent-install/agent-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function removeNodeFromLocalAndManagementHub() {
log_debug "removeNodeFromLocalAndManagementHub() begin"
log_info "Check node status for agent pod: ${POD_ID}"

NODE_INFO=$($KUBECTL exec -it ${POD_ID} -n ${AGENT_NAMESPACE} -- bash -c "hzn node list")
NODE_INFO=$($KUBECTL exec ${POD_ID} -n ${AGENT_NAMESPACE} -c "anax" -- bash -c "hzn node list")
NODE_STATE=$(echo $NODE_INFO | jq -r .configstate.state | sed 's/[^a-z]*//g')
NODE_ID=$(echo $NODE_INFO | jq -r .id | sed 's/\r//g')
log_debug "NODE config state for ${NODE_ID} is ${NODE_STATE}"
Expand Down Expand Up @@ -269,11 +269,11 @@ function unregister() {
fi

set +e
$KUBECTL exec -it ${POD_ID} -n ${AGENT_NAMESPACE} -- bash -c "${HZN_UNREGISTER_CMD}"
$KUBECTL exec ${POD_ID} -n ${AGENT_NAMESPACE} -c "anax" -- bash -c "${HZN_UNREGISTER_CMD}"
set -e

# verify the node is unregistered
NODE_STATE=$($KUBECTL exec -it ${POD_ID} -n ${AGENT_NAMESPACE} -- bash -c "hzn node list | jq -r .configstate.state" | sed 's/[^a-z]*//g')
NODE_STATE=$($KUBECTL exec ${POD_ID} -n ${AGENT_NAMESPACE} -c "anax" -- bash -c "hzn node list | jq -r .configstate.state" | sed 's/[^a-z]*//g')
log_debug "NODE config state is ${NODE_STATE}"

if [[ "$NODE_STATE" != "unconfigured" ]] && [[ "$NODE_STATE" != "unconfiguring" ]]; then
Expand All @@ -299,7 +299,7 @@ function deleteNodeFromManagementHub() {
log_info "Deleting node ${node_id} from the management hub..."

set +e
$KUBECTL exec -it ${POD_ID} -n ${AGENT_NAMESPACE} -- bash -c "${EXPORT_EX_USER_AUTH_CMD}; hzn exchange node remove ${node_id} -f"
$KUBECTL exec ${POD_ID} -n ${AGENT_NAMESPACE} -c "anax" -- bash -c "${EXPORT_EX_USER_AUTH_CMD}; hzn exchange node remove ${node_id} -f"
set -e

log_debug "deleteNodeFromManagementHub() end"
Expand All @@ -315,7 +315,7 @@ function verifyNodeRemovedFromManagementHub() {
log_info "Verifying node ${node_id} is removed from the management hub..."

set +e
$KUBECTL exec -it ${POD_ID} -n ${AGENT_NAMESPACE} -- bash -c "${EXPORT_EX_USER_AUTH_CMD}; hzn exchange node list ${node_id}" >/dev/null 2>&1
$KUBECTL exec ${POD_ID} -n ${AGENT_NAMESPACE} -c "anax" -- bash -c "${EXPORT_EX_USER_AUTH_CMD}; hzn exchange node list ${node_id}" >/dev/null 2>&1
if [ $? -ne 8 ]; then
log_warning "Node was not removed from the management hub"
fi
Expand Down

0 comments on commit b9b6e0a

Please sign in to comment.