#!/bin/bash
## xe-remove-template.sh, remove template by name on local xenserver instance
## Author:  Michael Bieri <mb@alonso.ch>
## Warning: This script has no brain - use your own!
 
UUID=$(xe template-list name-label="$1" --minimal)
 
if [[ -z $UUID ]] ; then
    echo "Sorry - Template not found"
    echo "Usage: $0 <template-name>"
    exit 1
fi
 
echo "using UUID: $UUID"
 
xe template-param-remove uuid=$UUID param-name=other-config param-key=default_template
xe template-uninstall template-uuid=$UUID force=true
 
echo "Done"
