Skip to content

Commit

Permalink
2 Small fixes for the observability scripts (#14)
Browse files Browse the repository at this point in the history
* Fix negation of cli check

Signed-off-by: Jeroen van Erp <[email protected]>

* Fix deletion of stackpack

Signed-off-by: Jeroen van Erp <[email protected]>

---------

Signed-off-by: Jeroen van Erp <[email protected]>
  • Loading branch information
hierynomus authored Sep 18, 2024
1 parent 8abd214 commit b7b8b5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/observability/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Install the SUSE Observability CLI
#######################################
observability_install_cli() {
if [ -x "$(command -v sts)" ]; then
if ! [ -x "$(command -v sts)" ]; then
curl -o- https://dl.stackstate.com/stackstate-cli/install.sh | STS_CLI_LOCATION=/usr/local/bin bash
else
echo ">>> sts CLI already installed"
Expand Down
5 changes: 4 additions & 1 deletion scripts/observability/stackpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ observability_delete_stackpack() {
local service_token=$2
local cluster_name=$3

if observability_check_stackpack $url $service_token $cluster_name; then
local stackpacks stackpack_id
stackpacks=$(/usr/local/bin/sts stackpack list-instances --name kubernetes-v2 -o json --url $url --service-token $service_token)
stackpack_id=$(echo $stackpacks | jq -r '.instances[] | select(.config.kubernetes_cluster_name == "'$cluster_name'") | .id')
if [ -n "$stackpack_id" ]; then
/usr/local/bin/sts stackpack uninstall --id $stackpack_id --url $url --service-token $service_token --name kubernetes-v2
echo ">>> StackPack for cluster '${cluster_name}' deleted"
else
Expand Down

0 comments on commit b7b8b5c

Please sign in to comment.