-
-
Save Boomatang/3a2fd6b6ae2b68c46a2fb8fd038395ea to your computer and use it in GitHub Desktop.
Get state of target cluster to trigger reminders of action.
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
#!/bin/bash | |
clusterIdentifier=$1 | |
OCM=~/go/bin/ocm | |
/usr/local/bin/ocm-stg-login | |
clusterInfo=$(${OCM} cluster list --managed | grep ${clusterIdentifier}) | |
clusterId=$(echo ${clusterInfo} | awk '{print $1}') | |
clusterName=$(echo ${clusterInfo} | awk '{print $2}') | |
expiration=$(${OCM} get https://api.stage.openshift.com/api/clusters_mgmt/v1/clusters/"${clusterId}" | jq -r '.expiration_timestamp' | xargs -I{} date -d '{}') | |
notify-send "Cluster: ${clusterName} Expires: ${expiration}" \ | |
"Delete? ocm delete https://api.stage.openshift.com/api/clusters_mgmt/v1/clusters/${clusterId}" \ | |
-i /usr/share/pixmaps/fedora-logo-sprite.png \ | |
-t 20000 \ | |
-u normal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment