Some tests build the state file in the test itself and need to
be removed. However, some tests rely on sls files inside of the
integration file state tree. Therefore, in those tests, we have
nothing to remove.
* 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.
This test was failing when I ran it locally - I'm not sure why the
error isn't showing up in Jenkins, but I double checked the string
in the state and there should be single-quotes around the user name.
* 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
* Disallow negative value for fib number
Fibonacci number is supposed to be nonnegative. Add this new feature to
disallow negative value to be passed in for fib number.
* Minimize code duplication
* Use /etc/adjtime for Gentoo
* Add integration test for timezone module
In the case where a user does not have the LANG env set,
Python can't figure out how to encode Unicode during a popen call.
I could not find any combination of tricks, including setting the encoding
or the locale or the environment variable itself in the call to popen that
would mitigate this issue. This may well be a bug in the Python stdlib itself.
* 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...
* modules.virtualenv_mod: use correct pip bootstrap url
* modules.pip: raise error on mirrors arg
* states.pip: run mirrors test on < 7.0.0
* update pip integration test states to not use mirrors
* modules.pip: run mirrors tests on pip < 7.0.0
Conflicts:
- salt/cli/daemons.py
- salt/config/__init__.py
- salt/exceptions.py
- salt/pillar/foreman.py
- salt/returners/local_cache.py
- salt/states/saltmod.py
- salt/utils/__init__.py
- salt/utils/cloud.py
The merge conflicts in salt/cli/daemons.py are still present in this commit.
@s0undt3ch is going to resolve them after this commit.
In order to know which files need to be cleaned up, a file.directory state
looks at its requirements.
Previously, it only looked at the name attribute of the required state and
supposed it was the name of the file to keep within this directory. It's
not completely right, as a requirement can also be made against a state ID,
in which case the 'name' attribute of the required state then have to be
used.
Fix#8646
If an NPM package was specified as a
url (i.e. git://github.com/Unitech/pm2), the state would crash with an
IndexError. Assume that not every package installed globally is
specified with a URL.
Example failing state:
kvsio:
npm.installed:
- name: git+ssh://github.com/dougluce/kvs.io.git
```
07:39:05,449 [salt.minion :1178][ERROR ] A command in 'pip.list' had a problem: Traceback (most recent call last):
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/bin/pip", line 9, in <module>
load_entry_point('pip==1.3.1', 'console_scripts', 'pip')()
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pkg_resources/__init__.py", line 546, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2666, in load_entry_point
return ep.load()
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2339, in load
return self.resolve()
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pkg_resources/__init__.py", line 2345, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pip/__init__.py", line 13, in <module>
from pip.commands import commands, get_similar_commands, get_summaries
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pip/commands/__init__.py", line 6, in <module>
from pip.commands.bundle import BundleCommand
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pip/commands/bundle.py", line 5, in <module>
from pip.commands.install import InstallCommand
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pip/commands/install.py", line 5, in <module>
from pip.req import InstallRequirement, RequirementSet, parse_requirements
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pip/req/__init__.py", line 3, in <module>
from .req_install import InstallRequirement
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pip/req/req_install.py", line 20, in <module>
import pip.wheel
File "/tmp/salt-tests-tmpdir/6833-pip-upgrade-pip/lib/python2.6/site-packages/pip/wheel.py", line 23, in <module>
from pip.exceptions import InvalidWheelFilename, UnsupportedWheel
ImportError: cannot import name InvalidWheelFilename
```
- present func: should not require key/fingerprint.
In normal mode, key AND fingerprint can be omitted but
test mode requires them, so fix the test mode to behave same
way.
- absent function: return correct ret when change suppose to be made.
- refactor a bit.