summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils
Commit message (Collapse)AuthorAgeFilesLines
* urls - remove deprecated client key calls (#80751)HEADdevelJordan Borean2023-05-171-12/+16
|
* [sanity-mypy] Ignore re-import warning (#80763)Abhijeet Kasurde2023-05-101-1/+1
| | | | | | * get_origin is already imported warning can be ignore safely. Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* setup module, retry facter to handle --puppet errors (#80645)Brian Coca2023-05-081-15/+8
| | | | | | | | | * setup module, retry facter to handle --puppet errors facter versions have changed how they deal with the --puppet flag when puppet is not present, most versions will just ignore it and not error, but initial versions of facter 4 changed the behaviour (later reverted). fixes #80496
* Use ansible.module_utils.common.text.converters (#80704)Matt Clay2023-05-0313-14/+14
| | | Replace use of old `ansible.module_utils._text` and add a unit test to maintain backwards compatibility.
* _symbolic_mode_to_octal- fix raising ValueError for invalid symbolic modes ↵Sloane Hertel2023-04-271-4/+4
| | | | | | | (#80449) validate the full user and perm strings instead of just first character fixes unhelpful unarchive error for some invalid modes
* Remove deprecated FileLock class (#80438)Martin Krizek2023-04-271-100/+0
|
* Use target of /usr/bin/dnf for dnf version detection (#80550)Martin Krizek2023-04-211-50/+36
| | | Fixes #80376
* Implement checks, and backwards compat change, to move forward with UTF-8 ↵Matt Martz2023-04-171-8/+3
| | | | | only (#80370) Co-authored-by: Sandra McCann <samccann@redhat.com>
* argspec - fix validating type for required options that are None (#79677)Sloane Hertel2023-04-172-2/+2
| | | | | * Only bypass type validation for null parameters if the default is None. A default is mutually exclusive with required. * Prevent coercing None to str type. Fail the type check instead.
* fetch_url: remove auto disabling decompress when gzip is not available (#80474)Martin Krizek2023-04-111-6/+2
|
* Symbolic modes with X or =[ugo] always use original mode (#80132)Sean Reifschneider2023-04-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Symbolic modes with X or =[ugo] always use original mode (Fixes #80128) Here's what's happening, by way of this mode example: u=,u=rX At the first step in the loop, the "u" bits of are set to 0. On the next step in the loop, the current stat of the filesystem object is used to determine X, not the "new_mode" in the previous iteration of the loop. So while most operations kind of operate left to right, "X" is always going back to the original file to determine whether to set x bit. The Linux "chmod" (the only one I've tested) doesn't operate this way. In it, "X" operates on the current state the loop understands it is in, based on previous operations (and starting with the file permissions). This is an issue with "X" and any of the "=[ugo]" settings, because they are lookups. For example, if a file is 755 and you do "ug=rx,o=u", file module produces 0557 and chmod produces 0555. This really becomes a problem when you want to recursively change a directory of files, and the files are currently 755, but you want to change the directory to 750 and the files to 640. In chmod you can do "a=,ug=rX,u+w" (or "a=,u=rwX,g=rX"), and have it apply equally to the directory and the files. I can't come up with a single way in the ansible file module to deterministically, recursively, set a directory to 750 and the contents to 640 no matter what the current permissions are, as the code currently is. The fix is to pass in "new_mode" to _get_octal_mode_from_symbolic_perms in lib/ansible/module_utils/basic.py inside _symbolic_mode_to_octal. And then take "new_mode" as an argument and use it instead of the filesystem object stat.st_mode value. * Fixing my new unit test, fixing bug in test comments
* Only use the selectors code path when we are prompt matching (#79931)Matt Martz2023-04-041-41/+47
|
* Fix getting timeout for get mounts facts on Linux (#79847)Geoffroy Doucet2023-04-041-1/+1
| | | | | | * Fix how to get the gather_timeout setting while getting the mounts facts on Linux. Issue: #79844
* Add new dnf5 module (#80272)Martin Krizek2023-03-311-1/+4
|
* Improve Ansible.Basic.cs tempdir uniqueness (#80328)Jordan Borean2023-03-281-1/+2
| | | | | | | | | | | * Improve Ansible.Basic.cs tempdir uniqueness The current tempdir naming scheme can result in the same name if the remote worker starts at the same time as another. By using the process id it should add enough uniqueness to avoid this situation. * Fix sanity issues * Fix up compile issue on older hosts
* Ansible.Basic - Improve temporary file cleanup process (#80293)Jordan Borean2023-03-281-6/+263
| | | | | * Ansible.Basic - Improve temporary file cleanup process * Add comment on struct value used
* ansible-galaxy collection install retry improvements (#80180)Matt Martz2023-03-221-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * clog frag * Fix retries so that each explicit call to _call_galaxy is retried for the correct number of attempts. Fixes #80174 * Extend retry logic to common URL related connection errors. Fixes #80170 * Extend retries to downloading artifacts * Extend param docs for change * Rework the exception handling * Don't be overly broad, reduce to TimeoutError, and BadStatusLine for now * _download_file needs to raise AnsibleError.orig_exc * Remove unused import * Add IncompleteRead * Add socket.timeout for py39 * Add 502 to retry codes * Move http error code checking first * Use itertools.tee to replay the backoff_iterator instead of using a callable * Actually set a CLI default of 60s for timeout, to prevent implicit galaxy from using 10s as default from Request.open * Import typing * fix type hints * Use http.HTTPStatus instead of int HTTP error codes where feasible * Split exception handling Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua> * Add missing import --------- Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
* corrected class documentation (#80241)Sumanth Lingappa2023-03-161-1/+1
|
* Define all processor facts on s390x (#19755) (#79806)Yaakov Selkowitz2023-02-231-21/+33
| | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Update mypy to version 1.0.0 (#79963)Matt Clay2023-02-093-4/+4
|
* basic.py - Perform Python version check earlier (#79954)Matt Clay2023-02-081-13/+15
|
* pycompat24 - Remove support for Python <= 2.5 (#79953)Matt Clay2023-02-081-39/+1
|
* Fix detection of available hashlib algorithms (#79946)Matt Clay2023-02-081-30/+36
| | | | | | | | | | * Fix detection of available hashlib algorithms Detection of hashlib algorithms now works on Python 3.x. The new implementation works on Python 2.7 and later. Test coverage is provided by both integration and unit tests. * Add additional details about hashlib in docs
* Fix "pointless" strings detected by pylint (#79943)Matt Clay2023-02-074-12/+6
| | | Convert these strings to comments, since they are not valid docstrings.
* Clean up pointless statements (#79941)Matt Clay2023-02-071-1/+1
| | | | | | | * Add ignores for intentional pointless statements * Remove redundant docstring * Fix function docstring placement
* Update collections.abc imports (#79911)Matt Clay2023-02-038-44/+26
| | | | | | | | | | | | | | * Update `collections.abc` imports - Use `six.moves` for modules and module_utils - Use `collections.abc` for controller code This avoids using `ansible.module_utils.common._collections_compat`, which was added before the vendored `six` was updated to provide these imports. * Update _collections_compat to use six.moves Also update the custom pylint rule to reflect this change.
* Ignore necessary unused imports in module_utils (#79904)Matt Clay2023-02-0310-13/+14
|
* Remove unused stdlib imports from module_utils (#79905)Matt Clay2023-02-035-9/+0
|
* Remove unused internal imports from module_utils (#79906)Matt Clay2023-02-034-5/+0
|
* AddType - Support compiling with /unsafe C# code (#79853)Jordan Borean2023-01-311-0/+20
| | | | | * AddType - Support compiling with /unsafe C# code * Update Ansible version in docstring
* Ansible.Basic.cs - Fix compile error on PS 7.3.x (#79848)Matt Clay2023-01-311-0/+4
|
* Update mypy and its dependencies. (#79812)Matt Clay2023-01-253-7/+7
| | | | | | | * Update mypy and its dependencies. * Fix requirements. * Remove unnecessary matching constraints.
* Argument spec alias handling: actually report deprecated aliases in ↵Felix Fontein2023-01-192-14/+30
| | | | | | | | | | | | | | | suboptions, and fix warning message in suboptions when two aliases of the same option are used (#79740) * Normalize deprecation records. * Fix alias deprecations in suboptions. * Report in which option an alias warning happened for suboptions. * Add deprecation tests for suboptions. * Also test deprecation in list of dicts. * Adjust unit tests for toplevel alias deprecation field name change.
* Fix reporting of deprecated arguments for modules. (#79681)Felix Fontein2023-01-132-3/+19
|
* fix role argument spec error for invalid suboptions (#76578)Sloane Hertel2023-01-092-9/+55
| | | fixes https://github.com/ansible/ansible/issues/75536
* Update vendored distro (#79227)Christian Loos2022-11-231-80/+71
| | | | Commit bb35d41 in branch python2.7-support from 2022-10-10: https://github.com/python-distro/distro/commit/bb35d41
* openbsd factgs, use physmem instead of usermem for total mem (#79316)Darshan2022-11-081-1/+1
| | | Signed-off-by: darshanip <darshancoding@gmail.com>
* Fix up sanity problemsJordan Borean2022-11-022-6/+6
|
* Don't assume column index for netmask and broadcast (#79121)Matt Martz2022-10-131-8/+19
| | | | | * Don't assume column index for netmask and broadcast. Fixes #79117 * fix typo
* Misc Typo fixes (#79088)Abhijeet Kasurde2022-10-101-1/+1
|
* facts: List all local (scope host) IP address ranges (#79018)Donatas Abraitis2022-10-061-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | After changes: ``` "ansible_locally_reachable_ips": { "ipv4": [ "127.0.0.0/8", "127.0.0.1", "192.168.0.1", "192.168.1.0/24" ], "ipv6": [ "::1", "fe80::2eea:7fff:feca:fe68", ... ] }, ``` 192.168.1.0/24 is a local prefix, where any IP address inside this range is reachable locally (or outside this host if this prefix is announced via EGP/IGP). Signed-off-by: Donatas Abraitis <donatas.abraitis@hostinger.com>
* Add `use_rsa_sha2_algorithms` option for paramiko (#78789)Matt Martz2022-09-211-1/+4
| | | | | | Fixes #76737 Fixes #77673 Co-authored-by: Matt Clay <matt@mystile.com>
* Fix local facts unreadable (#76095)Ruediger Pluem2022-09-191-2/+9
| | | | | | * Catch exceptions during stat calls If such an exception is not caught it causes the complete local facts gathering to fail.
* Add OSMC to Debian OS_FAMILY_MAP (#78778)Markus Opolka2022-09-161-1/+1
| | | | | | | | | * Add OSMC to Debian OS_FAMILY_MAP - os_family fact of the Debian-based OSMC distribution was not detected correctly * tweak changelog Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
* Recover unix load average into an ansible_loadavg fact (#75319)David Moreau Simard2022-09-132-0/+33
| | | | | | | | | | * Recover unix load average into an ansible_loadavg fact The average load is available out of the box with os.getloadavg(). It adds useful context to the existing ansible_memory_mb and ansible_mounts facts that provide size and utilization or memory and disk space. * Add an integration test
* uri: added use_netrc argument to allow ignoring netrc (#74397) (#78569)Artur2022-09-121-7/+11
|
* Allow selection of TLS/SSL ciphers (#78650)Matt Martz2022-09-081-179/+196
| | | | * Allow selection of TLS/SSL ciphers. Fixes #78633 * Never pass None as the password. Fixes #53373
* Fix distro fact handling for Flatcar (#77635)Johanan Liebermann2022-09-071-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | * Fix distro fact handling for Flatcar The existence of the file /etc/flatcar/update.conf depends on bootstrap configuration typically provided by the user. For that reason this file is unsuitable for determining distro facts for Flatcar Container Linux. The distribution_release fact is meaningless in the case of Flatcar since Flatcar doesn't have named releases. The distribution_version fact, however, IS meaningful and should contain a number such as "3139.2.0". - Use /etc/os-release instead of /etc/flatcar/update.conf. - Drop the distribution_release fact. - Set the distribution_version fact. - Update distro test fixture for Flatcar - Generate the fixture using gen_distribution_version_testcase.py. - Override result.distribution and result.os_family manually as the generator script gives wrong values. - Use a recent Flatcar version. Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
* fetch_file - properly split files with multi-part file extensions (#75257)Sam Doran2022-09-061-2/+43
|
* Guard urllib3 imports against all exceptions. Fixes #78648 (#78667)Matt Martz2022-08-301-4/+4
|