hooks: Extract function for command execution

This function will be used by the openstacknet hook to execute commands
in a more convenient way, instead of repeating the logic to exit the
hook everywhere.

Change-Id: Id0bcc3be324d1afd9855f9d624cbe4efbf3cf6dd
Signed-off-by: Mike Kolesnik <mkolesni@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22583
Reviewed-by: Assaf Muller <amuller@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>