Commit Graph

19 Commits (9f899f94924fafeb330b1e8b18c970742da56e0d)

Author SHA1 Message Date
Matt Clay 9f899f9492
Require `from __future__ import annotations` (#81902) 8 months ago
Martin Krizek ed749cf0a0
Remove deprecated FileLock class (#80438) 1 year ago
Matt Clay 3b4f3c066a
Ignore necessary unused imports in module_utils (#79904) 1 year ago
Matt Clay b3307f1aa7
Remove unused stdlib imports from module_utils (#79905) 1 year ago
Matt Clay 639e3e30d7
Remove unused internal imports from module_utils (#79906) 1 year ago
Abhijeet Kasurde fee90b15a2
Misc typo fixes in module_utils (#76564) 2 years ago
Brian Coca e8ae7211da
deprecate FileLock (#75032)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
3 years ago
Sam Doran 888be697cb
Revert "Change default file permissions so they are not world readable (#70221)" (#71231)
* Revert "Change default file permissions so they are not world readable (#70221)"

This reverts commit 5260527c4a.

* Revert "Fix warning for new default permissions when mode is not specified (#70976)"

This reverts commit dc79528cc6.
4 years ago
Sam Doran 5260527c4a
Change default file permissions so they are not world readable (#70221)
* Change default file permissions so they are not world readable

CVE-2020-1736

Set the default permissions for files we create with atomic_move() to 0o0660. Track
which files we create that did not exist and warn if the module supports 'mode'
and it was not specified and the module did not call set_mode_if_different(). This allows the user to take action and specify a mode rather than using the defaults.

A code audit is needed to find all instances of modules that call atomic_move()
but do not call set_mode_if_different(). The findings need to be documented in
a changelog since we are not warning. Warning in those instances would be frustrating
to the user since they have no way to change the module code.

- use a set for storing list of created files
- just check the argument spac and params rather than using another property
- improve the warning message to include the default permissions
4 years ago
Brian Coca ac509d489b
Revert "stricter permissions on atomic_move when creating new file (#68970)" (#68983)
This reverts commit 566f2467f6.
4 years ago
Brian Coca 566f2467f6
stricter permissions on atomic_move when creating new file (#68970)
fixes #67794
  updated some tests that expected previous defaults
  CVE-2020-1736
4 years ago
Sam Doran 023c5167fd Revert "Use locking for concurrent file access (#52567)" (#54547)
This reverts commit e152b277cf.
5 years ago
Dag Wieers e152b277cf Use locking for concurrent file access (#52567)
* Use locking for concurrent file access

This implements locking to be used for modules that are used for
concurrent file access, like lineinfile or known_hosts.

* Reinstate lock_timeout

This commit includes:
- New file locking infrastructure for modules
- Enable timeout tests
- Madifications to support concurrency with lineinfile

* Rebase, update changelog and tests

We need to specify ansible_python_interpreter to avoid running interpreter discovery and selecting the incorrect interpreter.

Remove the import of lock in known_hosts since it is not used.
5 years ago
Andreas Krüger 18bf48cec2 Pull documentation of ansible.module_utils.basic from (improved) doc strings. (#48416) 6 years ago
Andreas Calminder 876b637208 move some of basic into common (#48078)
* move file functions into common.file

* move *_PERM_BITS and mark as private (_*_PERM_BITS)

* move get_{platform, distribution, distribution_version} get_all_subclasses and load_platform_subclass into common.sys_info

* forgot get_distribution_version, properly rename get_all_subclasses

* add common/sys_info.py to recursive finder test

* update module paths in test_platform_distribution.py

* update docstrings, _get_all_subclasses -> get_all_subclasses

* forgot to update names

* remove trailing whitespace
6 years ago
Andreas Calminder 3419c75411 make lockfile destination settable and update doc (#42795)
* make sure lock file is available for others when unlocking

* add tmpdir option and updated documentation
6 years ago
Brian Coca 222c907ffb
actually check we can run scm command for roles (#43315)
* actually check we can run scm command for roles
* a better error message than file not found
* more narrow exception hanlding
* refactor common functions for more extended use and further 'basic.py' separation
6 years ago
Toshio Kuratomi 780c8986af Add boilerplate from __future__ and type declarations 6 years ago
Andreas Calminder 577e66660d Simple file locking feature (#42024)
* class for file locking feature
6 years ago