Created
August 26, 2014 22:01
-
-
Save jhrcz/7573595f318926acc7c8 to your computer and use it in GitHub Desktop.
one-check-in-template-image-vs-image-owner
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 | |
# cat | bash -ls | |
# cat | VERBOSE=YES bash -ls | |
while read tplid | |
do | |
[ -n "$tplid" ] || continue | |
[ "$VERBOSE" = "YES" ] \ | |
&& echo "tpl: $tplid" | |
while read imgname | |
do | |
[ -n "$imgname" ] || continue | |
[ "$VERBOSE" = "YES" ] \ | |
&& echo " imgname: $imgname" | |
tplimgown=$( onetemplate show $tplid --xml | xmlstarlet sel -t -m "//VMTEMPLATE/TEMPLATE/DISK[IMAGE='$imgname']" -v IMAGE_UNAME -n ) | |
imgown=$( oneimage show $imgname --xml 2>/dev/null | xmlstarlet sel -t -m '//IMAGE' -v UNAME -n 2>/dev/null ) | |
[ -n "$imgown" ] || imgown="ERROR" | |
echo " tpl: $tplimgown" | |
echo " img: $imgown" | |
done < <( onetemplate show $tplid --xml | xmlstarlet sel --text -t -m '//VMTEMPLATE/TEMPLATE/DISK' -v IMAGE -n ) | |
done < <( onetemplate list --xml | xmlstarlet sel -t -m '//VMTEMPLATE_POOL/VMTEMPLATE' -v ID -n ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment