Last active
June 26, 2020 08:15
-
-
Save dofinn/71ac69bdf8f32947ebd8585825495731 to your computer and use it in GitHub Desktop.
Get state of target cluster to trigger reminders of action.
This file contains 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