Add host refresh
This commit is contained in:
30
rsc_ops.sh
30
rsc_ops.sh
@@ -112,6 +112,36 @@ EOF
|
||||
|
||||
}
|
||||
|
||||
rsc_get_host_id() {
|
||||
gql_list_targets='query PhysicalHosts($hostRoot: HostRoot!, $filter: [Filter!]) {
|
||||
physicalHosts(hostRoot: $hostRoot, filter: $filter) {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
||||
variables="{\"hostRoot\":\"LINUX_HOST_ROOT\",\"first\":50,\"filter\":[{\"field\":\"NAME_EXACT_MATCH\",\"texts\":[\"$RBK_HOST\"]},{\"field\":\"IS_RELIC\",\"texts\":[\"false\"]},{\"field\":\"IS_REPLICATED\",\"texts\":[\"false\"]},{\"field\":\"IS_KUPR_HOST\",\"texts\":[\"false\"]}],\"sortBy\":\"NAME\",\"sortOrder\":\"ASC\",\"childFilter\":[{\"field\":\"IS_GHOST\",\"texts\":[\"false\"]},{\"field\":\"IS_RELIC\",\"texts\":[\"false\"]}]}"
|
||||
|
||||
gqlQuery="$(echo $gql_list_targets)"
|
||||
gqlVars="$(echo $variables)"
|
||||
rsc_gql_query
|
||||
|
||||
# Get all matching host IDs (portable, no mapfile)
|
||||
host_ids=$(cat /tmp/rbkresponse.$$ | jq -r '.data.physicalHosts.nodes[] | .id')
|
||||
host_count=$(echo "$host_ids" | grep -c .)
|
||||
if [[ $host_count -ne 1 ]]; then
|
||||
echo "ERROR: Multiple hosts found for '$1':"
|
||||
cat /tmp/rbkresponse.$$ | jq -r '.data.physicalHosts.nodes[] | "\(.name) \(.id)"'
|
||||
exit_with_error
|
||||
fi
|
||||
# Set the first match (or empty if none)
|
||||
targetHostId=$(echo "$host_ids" | head -n 1)
|
||||
|
||||
#cat /tmp/rbkresponse.$$ | jq -r
|
||||
}
|
||||
|
||||
rsc_find_database () {
|
||||
|
||||
# if cluster_uuid is not set, get it
|
||||
|
||||
Reference in New Issue
Block a user