This allows the cron.set_job and cron.set_special commands to change
cron entries from special to non-special or vise-versa. It also removes
all changes to states/cron from this PR's original commit, while
retaining the behavioral changes to the cron.present state
The original assertion used "mock_method.call_args.assert_called_with",
which does nothing at all. Correct usage is either
"mock_method.call_args == ..." or "mock_method.assert_called_with(...)"
Previously when changing a cron.present job from using a normal time
specification to special or vice-versa, it would duplicate the entry in
the crontab.
When running the test suite it chunks, specially when running against
the changed files, some of the test groups might not collect any test
and Jenkins does not help with getting the exit code from scripts.
This is where ``pytest-custom-exit-code` comes in, it allows exiting
with a 0 exit code when no tests are collected.
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
Some test cases fail when run without root permission, because they want
to read/write to `/var/cache`:
```
python3 -m pytest -ra tests/pytests/unit/state/test_state_format_slots.py
```
`test_format_slots_parallel` fails with:
```
Process ParallelState(always-changes-and-succeeds):
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "salt/utils/process.py", line 996, in wrapped_run_func
return run_func()
File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "salt/state.py", line 2023, in _call_parallel_target
with salt.utils.files.fopen(tfile, "wb+") as fp_:
File "salt/utils/files.py", line 385, in fopen
f_handle = open(*args, **kwargs) # pylint: disable=resource-leakage
FileNotFoundError: [Errno 2] No such file or directory: '/var/cache/salt/minion/123/174993d470c5f21b548d929d1904021966cb279f'
```
fixes#61148
Signed-off-by: Benjamin Drung <bdrung@debian.org>
* Allow collecting Ansible Inventory from a minion
* Prevent crashing if ansible-playbook doesn't return JSON
* Add new 'ansible.discover_playbooks' method
* Include custom inventory when discovering Ansible playbooks
* Enhance 'ansible.discover_playbooks' to accept a list of locations
* Remove unused constants from Ansible utils
* Avoid string concatenation to calculate extra cmd args
* Add unit test for ansible.targets
* Add changes suggested by pre-commit
* Fix issue dealing with ungrouped targets on inventory
* Enable ansible utils for ansible roster tests
* Add tests for new ansiblegate module functions
* Improve Ansible roster targetting
* Remove unnecessary code from Ansible utils
* Add changelog
* Fix pylint issue
* Fix issue in documentation
* Fix issue parsing errors in ansiblegate state module
* Fix typo
* Better error handling on ansible.targets
* Fix lint issue
* Add pre-commit changes and missing import after rebase
* Fix pylint issues
* Add missing functions to ansible __load__
* Properly get separated copies from list
* Properly get separated copies from list
* Use explicit arguments names and avoid __utils__
* Set ANSIBLE_DEPRECATION_WARNINGS to False to avoid breaking execution
* Add missing env ANSIBLE_DEPRECATION_WARNINGS to playbooks function
* Add missing versionadded tags
* Update versions to 3006
Co-authored-by: Megan Wilhite <mwilhite@vmware.com>