* git.latest: fail gracefully for misconfigured remote repo
When the remote repo's HEAD refers to a nonexistent ref, this was
causing a traceback when we tried to check if the upstream tracking
branch needed to be changed after cloning the repo. This commit fixes
this traceback by gracefully failing the state when the remote HEAD is
not present in the ``git ls-remote`` output, but the desired remote
revision doesn't exist.
Additionally, a similar graceful failure now happens if the state is run
again after we gracefully fail the first time, and we need to set the
tracking branch. Trying to set the tracking branch when there is no
local branch would fail with an ambiguous error like "fatal: branch
'master' does not exist", so before we even attempt to set the tracking
branch, the state is failed with a more descriptive comment.
* Add integration test for #36242
* Fixing integration tests if azure is not present
* Fixing integration tests failures if 'git' command is missing
Skip git state integration tests if 'git' does not exists
Prevent OSError if 'git' command not found during _git_version()
* salt/crypt.py: clean up open filehandles
* salt/fileclient.py: clean up open filehandles
* salt/grains/core.py: clean up open filehandles
* salt/modules/cp.py: clean up open filehandles
* salt/modules/data.py: clean up open filehandles
* salt/modules/dnsutil.py: clean up open filehandles
* salt/modules/dockerng.py: clean up open filehandles
* salt/modules/inspectlib/collector.py: clean up open filehandles
* salt/modules/file.py: clean up open filehandles
* salt/modules/hosts.py: clean up open filehandles
* salt/modules/incron.py: clean up open filehandles
* salt/modules/dpkg.py: clean up open filehandles
* salt/modules/linux_sysctl.py: clean up open filehandles
* salt/modules/netbsd_sysctl.py: clean up open filehandles
* salt/modules/network.py: clean up open filehandles
* salt/modules/nftables.py: clean up open filehandles
* salt/modules/openbsd_sysctl.py: clean up open filehandles
* salt/modules/rh_ip.py: clean up open filehandles
* salt/modules/portage_config.py: clean up open filehandles
* salt/modules/status.py: clean up open filehandles
* salt/modules/tls.py: clean up open filehandles
* salt/modules/xapi.py: clean up open filehandles
* salt/modules/x509.py: clean up open filehandles
* salt/modules/virt.py: clean up open filehandles
* salt/modules/zcbuildout.py: clean up open filehandles
* salt/returners/local_cache.py: clean up open filehandles
* salt/utils/cloud.py: clean up open filehandles
* salt/states/pkgrepo.py: clean up open filehandles
* salt/states/x509.py: clean up open filehandles
* salt/transport/mixins/auth.py: clean up open filehandles
* salt/utils/__init__.py: clean up open filehandles
* salt/states/pkg.py: clean up open filehandles
* salt/utils/minion.py: clean up open filehandles
* salt/utils/openstack/nova.py: clean up open filehandles
* salt/utils/openstack/swift.py: clean up open filehandles
* salt/utils/process.py: clean up open filehandles
* salt/utils/templates.py: clean up open filehandles
* salt/utils/virt.py: clean up open filehandles
* tests/integration/__init__.py: clean up open filehandles
* tests/integration/cli/grains.py: clean up open filehandles
* tests/integration/client/standard.py: clean up open filehandles
* tests/integration/modules/hosts.py: clean up open filehandles
* tests/unit/utils/vt_test.py: clean up open filehandles
* tests/integration/shell/enabled.py: clean up open filehandles
* tests/integration/states/cmd.py: clean up open filehandles
* tests/integration/states/file.py: clean up open filehandles
* tests/integration/states/match.py: clean up open filehandles
* tests/unit/config_test.py: clean up open filehandles
* tests/unit/templates/jinja_test.py: clean up open filehandles
* tests/unit/utils/find_test.py: clean up open filehandles
* tests/integration/modules/state.py: clean up open filehandles
* Update dnsutil_test to reflect changes in fopen usage
* Add integration test for #34945
* file.recurse: Do not convert octal mode string to int
When we run file.makedirs_perms to create the dest directory, we pass
through the mode to file.check_perms. However, file.check_perms expects
an octal string, not an int. This causes the initial directory to be
chmod'ed to the wrong mode. When there are files in the source
directory, file.recurse will invoke the file.directory state to manage
files/dirs in that directory, and this ends up correcting the mode as we
simply pass the dir_mode to it. However, when there are only directories
in the source directory, this never happens and the incorrect mode
remains on the destination directory.
Fixes#34945.
* Add git.diff function
* Fail git.latest states with uncommitted changes when force_reset=False
Also, discard these changes when running the state if force_reset=True.
* Add integration test for case where there are uncommitted changes
This test uses ``pkg.list_upgrades`` to find a package which it assumes is
installed, to test ``pkg.installed`` with ``only_upgrade=True``. The
problem with that approach is that ``pkg.list_upgrades`` uses a dry-run
of an ``apt-get dist-upgrade`` to find the upgrades. On non-LTS Ubuntu
releases, a ``dist-upgrade`` results in upgrading to an entirely new
Ubuntu release, and new packages which would be installed by the
dist-upgrade (but are not currently installed) will be included in the
return data. This causes the test to fail when we attempt to run
``pkg.latest`` with ``only_upgrade=True`` on a package which is not
already installed.
This commit fixes the test by ensuring that our target package is
already installed, and continuing to iterate through the return data
from ``pkg.list_upgrades`` until a currently-installed package is found.
* Remove redundant usage of destructiveTest decorator
* Remove unnecessary SLS file
This simple state can be run using run_state
* Explicitly order tests
* Use run_state instead of invoking state.sls
* Ensure only one refresh_db done during pkg integration tests
* Add pkg.latest test for package without an epoch
* Optimize pkg.latest_version usage in pkg integration tests
* Clarify outcome when only_upgrade is used
* Add pkg.latest test with only_upgrade=True
This was commented out for reasons having nothing to do with anything
else going on in 0c069dd. Uncommenting this sanity check so that we are
notified if we need to update our targets in the future.
* Fix file.managed for Windows (#33181)
* Revert back to import string_types
For some reason, there is a problem with the following
code when run from the file.py module:
```
from salt.ext import six
comment = 'This is a string'
isinstance(comment, six.string_types)
```
When run from within the python shell it works fine.
* Add six import
* Fix some lint
* Use correct six import
* Changed it back to explicit import
* Additional comments specific to 2015.5
* Fix file.managed for real
* Move comment to clarify purpose
* update 2015.5.11 release notes (#33197)
* Add pip installed and removed test (#33178)
* Resolve issue with pkg module on Mint Linux (#33205)
Closes#32198
* Add run_on_start docs to schedule.rst (#32958)
Fixes#22580
* Backport #33021 manually to 2015.5 (#33044)
* Saltfile with pillar tests (#33045)
* add file.managed with pillar data tests
* do not require git for other tests
* Whitespace...