Merge pull request #8542 from s0undt3ch/0.17

Better `exec()` detection. Avoids esky build `NameError`.
fix use sudo pwuser not git attribute
Merge pull request #8583 from Jiaion/0.17

fix use sudo pwuser not git attribute
Add RenderError exception class

This class contains member variables that can be referenced when
performing exception handling.

Conflicts:
	salt/exceptions.py
Raise RenderError for yaml.scanner.ScannerError exceptions
Catch RenderError exceptions when rendering a template
Merge SaltRenderError and RenderError exceptions

I had created the RenderError exception to use for a yaml rendering fix
(see 27d4889), but later realized that SaltRenderError already existed.
This merges the two, allowing SaltRenderError to be used with or without
providing a line number and buffer.
salt.utils.templates.get_template_context -> salt.utils.get_context

This moves this function to salt.utils so that it can be used more
generally.
Fix refs to the RenderError exception class

These now use the new SaltRenderError exception class.
Fix jinja template error reporting

This fixes a problem where the wrong line number is reported when there
is an undefined jinja variable. It also provides context to pinpoint the
location of the bad line.

There is also additional cleanup here, the SaltTemplateRenderError class
is removed in favor of the new SaltRenderError, and
get_template_context() has been removed, since it has been moved to
salt.utils.get_context().

Conflicts:
	salt/utils/templates.py
Apply jinja renderer error line fix to TemplateSyntaxError

This applies the same fix made for jinja2.exceptions.UndefinedError to
jinja2.exceptions.TemplateSyntaxError, so that it reports the correct
line.
Updated docs to reflect salt-ssh requirement on msgpack
removed double colons in master documentation to match existing formatting
Improve module state documentation
file.replace: replicate ownership/permissions on new file

Since file.replace was changed to use fileinput.input (and perhaps
before this), this function would create a new file with the desired
replacements, and this file would be owned by the user running salt,
with permissions governed by the umask. This is not the expected
behavior. One would expect that the new file would have the same
ownership and permissions as the original file. This commit performs an
os.stat before making changes, and then sets the ownership/permissions
after the changes are made.

Rather than stat-ing the file again after making the changes, since stat
can be an expensive operation, the ownership and permissions are set
irrespective of whether or not they differ from the original state.
Add salt.utils.file_perms function

Converting the st_mode value from os.stat results to something usable
for os.chmod seemed like it would be a useful thing to have in
salt.utils, so this commit moves that functionality there.
Keep salt.utils.file_perms from causing a traceback in windows
Don't attempt to enforce ownership/permissions in windows

This commit restricts the fix from pull request #8417 to non-windows
minions, and also applies it to file.copy.
Remove salt.utils.file_perms

This was unnecessary due to salt.modules.file.check_perms() already
handling this.
Use file.check_perms to enforce ownership/permissions

The fix that I made in #8417 was incomplete in that it did not work on
symlinks. This uses an existing execution module function,
file.check_perms, to enforce the ownership and permissions.