Update SNG7: RPM command errored, tried to run '/usr/bin/rpm -q --queryformat

I had the same problem too, this is what i did to recover
Try to run yum update --skip-broken and also upgrade all fourn FreePBX modules by running fwconsole ma upgradeall

check also the following thread

there are many threads related to this problem.