summaryrefslogtreecommitdiff
path: root/test/units/modules
Commit message (Collapse)AuthorAgeFilesLines
* Fix hard-coded interpreter in test_async_wrapper (#80816)Matt Clay2023-05-161-2/+2
|
* Use ansible.module_utils.common.text.converters (#80704)Matt Clay2023-05-033-3/+3
| | | 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-0/+4
| | | | | | | (#80449) validate the full user and perm strings instead of just first character fixes unhelpful unarchive error for some invalid modes
* Symbolic modes with X or =[ugo] always use original mode (#80132)Sean Reifschneider2023-04-101-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Update collections.abc imports (#79911)Matt Clay2023-02-031-1/+1
| | | | | | | | | | | | | | * 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.
* Clean up unused imports in unit tests (#79893)Matt Clay2023-02-022-6/+0
|
* Prefer unittest.mock over mock. (#77886)Matt Clay2022-05-237-15/+13
|
* unarchive: fix io_buffer_size option, remove ignore.txt entry (#77271)Felix Fontein2022-03-181-0/+2
| | | | | | | | | * Fix io_buffer_size option. * Remove ignore.txt entry by adding action plugin only options to module's argument spec. * Add changelog fragment. * Adjust unit tests.
* Remove obsolete units.compat.mock compat layer. (#77118)Matt Clay2022-02-227-7/+9
| | | | * Remove obsolete units.compat.mock compat layer. * Update remaining units.compat.mock references.
* Resubmit: Use SystemdStrategy for Debian in the hostname module (#76929)Thomas Sjögren2022-02-091-0/+13
| | | | | | | | * add DebianStrategy tests * ensure hostname can be changed by using become * use Systemd strat for debian and Base for generic. * add test to ensure all strategies are available Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
* iptables - added a ``chain_management`` parameter to control chain (#76378)Éloi Rivard2022-01-241-13/+197
| | | | | | creation and deletion fixes #25099 closes #32158
* Unbreak hostname.RedHatStrategy (#76032)Martijn Pieters2021-11-151-0/+99
| | | | | | | - On Python 3, decode bytes to str - Tolerate whitespace around the line. - Report a missing HOSTNAME line as an error. - Don't clobber line separators when setting a new hostname. - Add some tests for this strategy to verify correct operation.
* pip - Use pip from the current Python interpreter. (#75634)Matt Clay2021-09-031-0/+2
| | | | | | | | | | | | | | | | | * pip - Use pip from the current Python interpreter. If `executable` and `virtualenv` were not specified, and the `pip` Python module is available for the current interpreter, use that `pip` module instead of searching for a `pip` command. * Add comment about needing `__main__` to run `pip`. * Fix unit test. * Add porting guide entry. * Update changelog to match porting guide description. ci_complete
* yum: fix parsing of check-update with subsequent empty lines (#75452)Martin Krizek2021-08-201-0/+15
| | | | | | | Rather than adding further complexity to the regex, preprocess the output to remove any empty lines. Now the only purpose of the regex is to fix wrapped lines. Fixes #70949
* modules moved to use best_parsable_locale (#75250)Brian Coca2021-07-151-0/+5
| | | | | | | | | | | | | | | * modules moved to use best_parsable_locale * fixed invocations * better better * also module_utils * converted to function as per fb * patch testt * whitespace
* get_distribution - Return distribution for all platforms (#71641)Sam Doran2021-06-111-0/+2
| | | | | | | | | | | | | | Since moving to distro, it is possible to return this information for all platforms, not just Linux. Also return version information for all platfrom not just Linux. Update unit tests. Remove some duplicate unit tests though I think there are more to remove. * Fix docstring formatting * Minor docstring changes * Mock distro.id for Solaris service test * Update comment
* apt_key: add --recv argument as last one (#74949)Jonathan Kirszling2021-06-111-0/+27
| | | | | | | | | * apt_key: add --recv argument as last one * Add unit test * Add the required boilerplate Co-authored-by: Marius Gedminas <marius@gedmin.as>
* unarchive - do not fail in init when trying to find required binary (#74892)Sam Doran2021-06-071-18/+33
| | | | | | | | | Test for the required binaries in the can_handle_archive() method and fail there. This prevents failures for missing binaries unrelated to the archive type. * Update missing zip binary message to match tar message * Update unit tests * Add integration tests * Define packages based on the system rather than ignoring failures
* unarchive: Fail when zipinfo is not available (#74632)Abhijeet Kasurde2021-06-021-0/+76
| | | | | Fixes: #39029 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Remove commented code (#74860)Abhijeet Kasurde2021-06-011-10/+0
| | | Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* hostname: clean up strategiesAlexander Sowitzki2021-05-271-1/+1
| | | | Apply #74744 and #69929 to #70828
* [hostname] don't write in get_*() methodsRick Elrod2021-05-271-0/+35
| | | | | | | | | | | | | | | | Change: - Hostname strategies' get_*() methods should never write to the filesystem. They are used in check_mode by default to determine if there is any work to be done. Test Plan: - New unit tests to ensure that (at least when in check_mode) the get methods don't ever call write. Tickets: - Fixes #66432 Signed-off-by: Rick Elrod <rick@elrod.me>
* async_wrapper more info on end (#74199)Brian Coca2021-04-131-2/+3
| | | | | | be consistent on information returned normalize 'return functions' fix unit test add a bit more context on some failures
* Solaris: Correct version check in svcadm_supports_sync API (#73860)Guillermo Adrián Molina2021-04-101-0/+68
| | | Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
* Fix comment in iptables unit test (#74061)Amin Vakil2021-03-301-1/+1
|
* iptables: Added set module/match_set support (#72984)Martin Zimmermann2021-01-111-0/+63
|
* iptables: Adding multiport module support (#72928)Martin Zimmermann2020-12-141-0/+36
|
* iptables: Reorder comment postition (#71496)Amin Vakil2020-11-091-0/+41
| | | | | | | | | | | | | | | | | | | * Reorder comment postition * Add comment unit test * Fix unit test * Fix unit test * Add changelog * Add paramaters which would be problematic without this fix * Fix typo * Fix unit test * Fix unit test
* service_facts: return service state information on AIX (#72073)dberg12020-10-131-0/+126
| | | | | | | | | | * service_facts: return service state information on AIX AIX uses the System Resource Controller (SRC) to manage services. See https://www.ibm.com/support/knowledgecenter/ssw_aix_72/osmanagement/sysrescon.htm Use lssrc command on AIX to return service state information. Co-authored-by: dberg1 <dberg1@github.com>
* sanity: remove ansible-bad-function (#70431)Abhijeet Kasurde2020-07-071-1/+1
| | | | | | * Updated docs and ignore.txt * Replaced with correct function calls Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Add intentional unit tests for basic._set_cwd and common.dict_merge (#70283)jctanner2020-06-251-0/+57
| | | | | | | * Add unit tests for basic._set_cwd * incidental coverage for dict_merge * add test for async stderr inclusion
* Clean up unit test boilerplate.Matt Clay2020-06-229-2/+24
|
* Flatten the directory hierarchy of modules (#68966)Matt Martz2020-05-1311-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Flatten the directory hierarchy of modules * Update ignore.txt, flatten units * Update imports * Completely flatten the modules directory * Update sanity ignore * Fix some sanity test ignores * Fix relative import * Fix docs builds without category * ci_complete * Clean up docs. ci_complete * Adjust needs/file alias * ci_complete * fix hardcoded ping module paths Co-authored-by: Matt Davis <mrd@redhat.com>
* Remove unused unit test files.Matt Clay2020-03-238-207/+0
|
* migration final cleanupAnsible Core Team2020-03-2370-0/+0
|
* Migrated to vyos.vyosAnsible Core Team2020-03-2326-2445/+0
|
* Migrated to openvswitch.openvswitchAnsible Core Team2020-03-2314-752/+0
|
* Migrated to dellemc_networking.os6Ansible Core Team2020-03-2316-748/+0
|
* Migrated to dellemc_networking.os9Ansible Core Team2020-03-2315-2091/+0
|
* Migrated to dellemc_networking.os10Ansible Core Team2020-03-2313-21290/+0
|
* Migrated to junipernetworks.junosAnsible Core Team2020-03-2328-1542/+0
|
* Migrated to openstack.cloudAnsible Core Team2020-03-231-228/+0
|
* Migrated to f5networks.f5_modulesAnsible Core Team2020-03-23311-50036/+0
|
* Migrated to cisco.nxosAnsible Core Team2020-03-23132-11111/+0
|
* Migrated to cisco.iosxrAnsible Core Team2020-03-2325-1725/+0
|
* Migrated to cisco.iosAnsible Core Team2020-03-2346-3475/+0
|
* Migrated to cisco.asaAnsible Core Team2020-03-233-188/+0
|
* Migrated to arista.eosAnsible Core Team2020-03-2338-3061/+0
|
* Migrated to check_point.mgmtAnsible Core Team2020-03-2389-8845/+0
|
* Migrated to netapp.ontapAnsible Core Team2020-03-2358-15173/+0
|