Problem with VM_HOOK template and xpath.rb

Hi!

I’m creating a VM_HOOK on DONE to clean up the old computer objects out of AD/DNS/Security groups, etc. I’m passing to the bash script the $TEMPLATE argument. In my hook script, I get the valid template (took the base64 and decoded it successfully, then validated the xml successfully), however I’m getting the following errors…any ideas?

Thanks!

/usr/share/ruby/rexml/parsers/treeparser.rb:95:in rescue in parse': #<ArgumentError: invalid byte sequence in UTF-8> (REXML::ParseException) /usr/share/ruby/rexml/source.rb:219:in match’
/usr/share/ruby/rexml/source.rb:219:in match' /usr/share/ruby/rexml/parsers/baseparser.rb:202:in pull_event’
/usr/share/ruby/rexml/parsers/baseparser.rb:183:in pull' /usr/share/ruby/rexml/parsers/treeparser.rb:22:in parse’
/usr/share/ruby/rexml/document.rb:287:in build' /usr/share/ruby/rexml/document.rb:43:in initialize’
/var/lib/one/remotes/datastore/xpath.rb:58:in new' /var/lib/one/remotes/datastore/xpath.rb:58:in

invalid byte sequence in UTF-8
Line: 1
Position: 21
Last 80 unconsumed characters:
LC,��#�LE��!�4
from /usr/share/ruby/rexml/parsers/treeparser.rb:20:in parse' from /usr/share/ruby/rexml/document.rb:287:in build’
from /usr/share/ruby/rexml/document.rb:43:in initialize' from /var/lib/one/remotes/datastore/xpath.rb:58:in new’
from /var/lib/one/remotes/datastore/xpath.rb:58:in <main>' ./on_vm_destroy.sh: line 4: vmname: command not found /usr/share/ruby/rexml/parsers/treeparser.rb:95:in rescue in parse’: #<ArgumentError: invalid byte sequence in UTF-8> (REXML::ParseException)
/usr/share/ruby/rexml/source.rb:219:in match' /usr/share/ruby/rexml/source.rb:219:in match’
/usr/share/ruby/rexml/parsers/baseparser.rb:202:in pull_event' /usr/share/ruby/rexml/parsers/baseparser.rb:183:in pull’
/usr/share/ruby/rexml/parsers/treeparser.rb:22:in parse' /usr/share/ruby/rexml/document.rb:287:in build’
/usr/share/ruby/rexml/document.rb:43:in initialize' /var/lib/one/remotes/datastore/xpath.rb:58:in new’
/var/lib/one/remotes/datastore/xpath.rb:58:in <main>' ... invalid byte sequence in UTF-8 Line: 1 Position: 15 Last 80 unconsumed characters: LC,��#�LE��C from /usr/share/ruby/rexml/parsers/treeparser.rb:20:in parse’
from /usr/share/ruby/rexml/document.rb:287:in build' from /usr/share/ruby/rexml/document.rb:43:in initialize’
from /var/lib/one/remotes/datastore/xpath.rb:58:in new' from /var/lib/one/remotes/datastore/xpath.rb:58:in
./on_vm_destroy.sh: line 5: email: command not found

If I run xpath.rb directly and pass it the base64 encoded XML, I get:

/var/lib/one/remotes/datastore/xpath.rb --base64 template UNAME
XML

/var/lib/one/remotes/datastore/xpath.rb:67:in block in <main>': undefined methodelements’ for nil:NilClass (NoMethodError)
from /var/lib/one/remotes/datastore/xpath.rb:61:in each' from /var/lib/one/remotes/datastore/xpath.rb:61:in
[root@devportal hooks]# nano /var/lib/one/remotes/datastore/xpath.rb
[root@devportal hooks]# /var/lib/one/remotes/datastore/xpath.rb --base64 template UNAME
/var/lib/one/remotes/datastore/xpath.rb:66:in block in <main>': undefined methodelements’ for nil:NilClass (NoMethodError)
from /var/lib/one/remotes/datastore/xpath.rb:60:in each' from /var/lib/one/remotes/datastore/xpath.rb:60:in