Fix for managing debian repos with trailing slashes in the URI

This commit modifies apt.py's expand_repo_def and list_repos (as well as
get_repo, as it uses list_repos) functions to strip the trailing slash.
This allows for repo definitions to be created with trailing slashes,
and for a trailing slash to not result in a failure to match a repo.

Additionally, this commit has fixes for generic "raise Exception" usage,
instead using salt.exceptions.CommandExecutionError as it avoids
tracebacks in the CLI output.

Finally, some manual quoting has been converted to using raw strings.

Conflicts:
	salt/states/pkgrepo.py
Make newly-added repo available to pkg states

If a package is added using a pkgrepo.managed state, and a pkg.installed
state needs access to this newly-added repo, it will not be able to find
the package since the pkg.refresh_db happens in the call to pkg.install
(just prior to the package installation), and not when the package
targets are initially looked for. This commit adds a pkg.refresh_db
before the targets are checked, and then supresses the refresh_db when
the package is actually installed (because at that point, it would be
redundant).
Improve error reporting from verify_files

Make it similar to what verify_env already does, so that
we tell people exactly which path was a problem.  I hit this
while running salt-master in a non-standard configuration, and
the change makes it easier to hunt down which path is wrong
in a config.
Back out earlier fix.
Workaround bug in yum python API

This works around a bug in the yum python API where removal of packages
that are required by other packages results in the removal of those
packages as well, and does not raise an exception when errors are
encountered during the transaction test, causing all packages to be
removed.

This commit manually performs the transaction test, and raises an
exception if any errors are found. It also adds a try/except to the
pkg.removed and pkg.purged states which catches the exception and
gracefully returns False without a traceback.

See https://github.com/saltstack/salt/issues/8201 for more information.

Conflicts:
	salt/states/pkg.py
fix function： leaks，serverinfo

#salt 'web-87' tomcat.leaks
web-87:
    F
    a
    i
    l
    e
    d

    t
    o

    c
    r
    e
    a
    t
    e

    H
    T
    T
    P

    r
    e
    q
    u
    e
    s
    t

#salt 'web-87' tomcat.serverinfo
web-87:
    ----------
    error:
        F
Make sure we're getting a dict
More aggressive exception handling and retry logic. Refs #7755.
Import logging.
Skip malformed files during reaping. We can just as easily catch them the next time.
Silence Pylint warning.
Typo fix
Updating capitalization
Change to yaml.dump

Conflicts:
	salt/client/ssh/__init__.py
git: new `git.ls_remote` with similar interface than other Git functions

Inspired from salt.states.git.__ls_remote__, which it aims to replace.
git: use the new git.ls_remote function

The interface of this function is similar to the other Salt Git's functions
and it uses the 'identity' settings which is set in the state.

Fixes #8094
Fix --output-file CLI argument

This commit fixes it so that the file in not overwritten each time a
minion returns information. Fixes #8205.
Remove existing output file if present

This saves the use of a filehandle by simply removing the file instead
of truncating it. when salt.output.display_output comes along to append
to the file, it will be created if it does not already exist.
Modify system shutdown command.

New flag to shutdown at a given time. Refs #7833.
Correctly detect a git checkout. Refs #8090. Fixes #8266.

The problem is that when we `exec()` the version code from `setup.py`, the `__file__` paths changed and we were "missing" the `.git` directory.