- API_KEY=`sudo maas-region apikey --username=ubuntu`
- maas login $PROFILE $API_SERVER $API_KEY
-
- # make sure there is no machine entry in maas
- for m in $(maas $PROFILE machines read | jq -r '.[].system_id')
- do
- maas $PROFILE machine delete $m || true
- done
- maas $PROFILE pod delete 1 || true
-
+ if which maas > /dev/null; then
+ API_KEY=`sudo maas-region apikey --username=ubuntu`
+ maas login $PROFILE $API_SERVER $API_KEY
+
+ # make sure there is no machine entry in maas
+ for m in $(maas $PROFILE machines read | jq -r '.[].system_id')
+ do
+ maas $PROFILE machine delete $m || true
+ done
+ podno=$(maas $PROFILE pods read | jq -r ".[]".id)
+ maas $PROFILE pod delete $podno || true
+ fi