Use salt's environment verification. Refs #346.

Should create required directories with proper permissions, even the logging one.
Fix `SyntaxError`.
Merge pull request #380 from s0undt3ch/issues/346

Use salt's environment verification. Refs #346.
use correct exit status code on error
refactored cli module to use if-else and print output and exit on success in one place
added exception handler to do_function block
change query option to be mutually exclusive like the rest