core:unlock_entity.sh is not unlocking the vm...

unlock_entity.sh is not unlocking the vm, only images under the vm

Fixing the query to remove the vm/template when -r flag is given by
changing the order of execution and replacing the nested query with a
simple assignment.

Change-Id: I21ae0588a24ae93c26a4a44f296e05c3a411d677
Signed-off-by: Eli Mesika <emesika@redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=901971