ipalib.frontend: Do API version check before converting arguments

This results in the proper message being shown if the client sends
an option the server doesn't have yet.

It also adds the check to commands that override run() but not __call__,
such as `ipa ping`, and to commands run on the server. Adjust tests
for these changes.

https://fedorahosted.org/freeipa/ticket/3963

Reviewed-By: Martin Kosek <mkosek@redhat.com>
sudorule: PEP8 fixes in sudorule.py
sudorule: Allow using hostmasks for setting allowed hosts
sudorule: Allow using external groups as groups of runAsUsers
sudorule: Make sure sudoRunAsGroup is dereferencing the correct attribute
sudorule: Include externalhost and ipasudorunasextgroup in the list of default attributes
sudorule: Allow adding deny commands when command category set to ALL
sudorule: Make sure all the relevant attributes are checked when setting category to ALL
sudorule: Fix the order of the parameters to have less chaotic output
sudorule: Enforce category ALL checks on dirsrv level
ipatests: test_sudo: Add tests for allowing hosts via hostmasks
ipatests: test_sudo: Add coverage for external entries

Covers functionality of external entries for:
* users
* runAsUsers
* groups of RunAsUsers
* runAsGroups
ipatests: test_sudo: Add coverage for category ALL validation

Makes sure sudorules behave correctly both when adding new entries
with corresponding category set to ALL, and when setting the
category to all when corresponding entries exist.

The only exception of deny commands with cmdcategory ALL is
covered as well.
ipatests: test_sudo: Fix assertions not assuming runasgroupcat set to ALL
ipatests: test_sudo: Do not expect enumeration of runasuser groups
ipatests: test_sudo: Expect root listed out if no RunAsUser available
sudorule: Refactor add and remove external_post_callback