Commit Graph
71 Commits
Author SHA1 Message Date
David ShrewsburyandGitHub d772fe65b7 Use errno symbol instead of hardcoded value in wait_for (#87087) 2026-06-11 11:31:41 -04:00
David ShrewsburyandGitHub 08a71d148e Fix IndexError in free strategy when hosts become unreachable (#87037)
* Fix IndexError in free strategy when hosts become unreachable

Fixes an IndexError crash in the free strategy plugin when hosts
become unreachable during playbook execution.

The bug occurred when:
- last_host index persists across outer loop iterations
- hosts_left is regenerated each iteration via get_hosts_left()
- Some hosts become unreachable between iterations
- hosts_left shrinks but last_host retains its previous value
- Accessing hosts_left[last_host] raises IndexError

The fix adds a bounds check after regenerating hosts_left to reset
last_host to 0 if it's out of bounds. This preserves the round-robin
fairness algorithm while preventing the IndexError.

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* integration test

* review comment fixes

* ci_complete
2026-06-09 12:16:31 -04:00
ea0024944f Fix dnf/dnf5 documentation for exclude parameter (#87034)
* Sanity fix
* Test dnf `exclude` parameter


Co-authored-by: Patrick Kingston <pkingsto@redhat.com>
2026-05-27 05:35:01 -07:00
David ShrewsburyandGitHub 776f90ae4b Handle None return from read() in run_command() (#86922) 2026-04-30 15:03:21 -04:00
David ShrewsburyandGitHub 2341354ffa Replace gpg in rpm_key with librpm (#86237)
* Replace gpg in rpm_key with librpm

* Manually compute primary key ID and fingerprint for older librpm

* Code cleanup

* Add some v6 tests

* Add rhel 10.1 to CI matrix and changelog

* Remove RHEL 10.0

* consolidate common code and rename unused vars

* remove unnecessary exception raise

* Fix return type

* review comments: change import and use of Optional

* ci_complete ci_coverage

* address review comments

* When checking for existing keys, account for short from key ID and revert test change that hid this

* Support RPM version 6+. Allow 'key' to be fingerprint.

* Replace v6 test key with non-PQC algo version and enable Fedora v6 tests

* modify changelog, mod doc, and del 10.1 test req

* Code refactor and new tests

Refactor code to not need to use librpm API to get list of installed
keys. Also add new tests to verify deleting by fingerprint.

* Refactor drop_key() by rpm version, fully type hint code

* use hexdigest()
2026-03-03 16:57:17 +00:00
David ShrewsburyandGitHub 90595736ed Fix local connection interaction with become plugins (#86473)
The local connection plugin is incorrectly passing a bytearray to methods of become plugins that expect bytes. A recent change to the su plugin exposed this by breaking the become plugin for different locale settings (the bytearray was not properly converted to a str for comparison operations). This changes the local connection plugin to send bytes.
2026-02-02 09:02:53 -05:00
David ShrewsburyandGitHub dc3cc0f9ea Fix test_encrypt.py unit test (#86180) 2025-11-12 09:54:25 -05:00
David ShrewsburyandGitHub 83d2ce771c Modify crypt library import pattern (#86120)
Hide the functionality of the _internal/_encryption/_crypt.py module
behind an object so that we don't have code executed at import time.
2025-11-11 17:33:45 -05:00
e3cff24134 Increase code coverage of utils/encrypt.py (#86060)
* Add encryption code coverage

Co-authored-by: Matt Clay <matt@mystile.com>
2025-11-06 15:26:41 -05:00
David ShrewsburyandGitHub feda8fc564 Fix flakey get_url test (#85953) 2025-10-06 18:42:03 -07:00
David ShrewsburyandGitHub aa8d58a174 get_url - check for incomplete data read (#85164) 2025-06-10 15:17:22 -05:00
David ShrewsburyandGitHub eb44c77968 Remove tests for ansible-runner (#82571) 2024-02-06 09:50:54 -06:00
David ShrewsburyandGitHub 703cb79442 Implement async callbacks (#74953)
* add changelog and output from default callback
* add test
* add comments about TE task
2021-06-22 12:19:32 -04:00
David ShrewsburyandGitHub 2387ce311f remove reference to container ML (#75014) 2021-06-16 10:47:26 -04:00
David ShrewsburyandGitHub 97acb0f470 role argspec - tag role argspec validation task with 'always' (#74994)
* update tag docs
2021-06-14 13:28:56 -04:00
David ShrewsburyandGitHub 6539c59857 ansible-pull - update help info for --directory option (#74936)
* Update -d help info for ansible-pull

* fix pep8
2021-06-11 05:31:17 +10:00
David ShrewsburyandGitHub 51b5659598 replace - better handling of file exceptions (#74686) 2021-05-13 17:00:22 -04:00
8fb54885bf Role argspec: allow new argument spec file (#74582)
* support separate role argspec file in ansible-doc

* support separate role argspec file in ansible-core

* support both .yml and .yaml extensions on argspec file in ansible-doc

* fix filename building bug and rename some argspec files to test variations

* use yaml extensions from constants

* add superfluous meta/main.yml files to tests

* Update lib/ansible/cli/doc.py

Co-authored-by: Sam Doran <sdoran@redhat.com>

* update docs

* ci_complete

* add changelog and allow for main.yml variations

* add collection role testing

Co-authored-by: Sam Doran <sdoran@redhat.com>
2021-05-11 09:29:47 -05:00
David ShrewsburyandGitHub c6fda9fc1a [coverage] improve test coverage for together lookup (#74549) 2021-05-04 11:41:22 -04:00
David ShrewsburyandGitHub 4f0a9488bb [coverage] improve test coverage for indexed_items lookup (#74548) 2021-05-04 11:41:02 -04:00
David ShrewsburyandGitHub 244bf9c640 [coverage] improve test coverage for vars lookup (#74546) 2021-05-04 11:39:04 -04:00
David ShrewsburyandGitHub f1a5c411d9 Fix sequence lookup message and add tests (#74472)
* add test for bad kv arg value
* add simple form parsing tests and make error messages the same
* add changelog
2021-04-29 15:12:23 -04:00
David ShrewsburyandGitHub 98495ae99d Remove unused FileLock import (#74449) 2021-04-29 15:04:34 -04:00
David ShrewsburyandGitHub d44eb03f49 Remove include from tests (#74330) 2021-04-20 11:19:29 -04:00
David ShrewsburyandGitHub 5e55af2f02 [test coverage] Add tests for set_stats (#74243)
* satisfy the all-knowing, ever present God of Sanity and use 'grep -c' vs. 'wc -l'
2021-04-13 11:43:53 -04:00
93fdba7013 [bugfix][coverage] find module should consider file size with file_type=any (#74241)
* add changelog
* fix cl text
* Update changelogs/fragments/74241-find-checks-size-with-any.yml

Co-authored-by: Rick Elrod <rick@elrod.me>
2021-04-13 11:41:44 -04:00
David ShrewsburyandGitHub d5ce6e6bed Increase test coverage for command module (#74183) 2021-04-08 15:24:01 -04:00
David ShrewsburyandGitHub d1842afd59 ansible-inventory - add coverage tests (#74130) 2021-04-06 12:14:54 -04:00
David ShrewsburyandGitHub 1cacf933b7 lineinfile - improve test coverage (#74122) 2021-04-06 12:11:10 -04:00
David ShrewsburyandGitHub 1e5ccb326f Allow for searching handler subdir for included tasks (#73809)
* Allow for searching handler subdir for included tasks
2021-03-15 15:39:59 -04:00
David ShrewsburyandGitHub 78d3810fdf Auto cleanup of async cache file (#73760)
* Auto cleanup of async cache file

* Add changelog
2021-03-04 11:06:27 -08:00
David ShrewsburyandGitHub c8ee186e11 Remove warning about role validation with deps (#73653)
* Remove warning about role validation with deps

* add changelog

* update cl
2021-02-18 17:16:03 -06:00
David ShrewsburyandGitHub d1d9406066 Add rolespec_validate to import/include_role (#73589)
* Add rolespec_validate to import/include_role

* Add changelog

* fix sanity, not private
2021-02-12 16:26:33 -06:00
David ShrewsburyandGitHub f0ec10dbc3 Role arg spec validation implementation (#73152)
* Initial import of modified version of alikins' code
* Add unit testing for new Role methods
* Fix validate_arg_spec module for sanity test. Add test_include_role_fails.yml integration test from orig PR.
* Add testing of suboptions
* Use new ArgumentSpecValidator class instead of AnsibleModule
* fix for roles with no tasks, use FQ name of new plugin
* Add role dep warning
2021-02-12 16:00:17 -05:00
David ShrewsburyandGitHub c8666f07d7 Add support for argument_specs attribute to RoleMetadata class (#73120) 2021-01-07 11:41:46 -05:00
David ShrewsburyandGitHub 3a18ef7159 Change role argspec file used by ansible-doc (#72927)
* Change role argspec file used by ansible-doc

This changes the file used for role argument specs from meta/argument_specs.yml
to meta/main.yml. The argument specs are expected to be in that file under the
top-level entry of `argument_spec`.

* Switch to argument_specs
2020-12-14 12:05:40 -05:00
David ShrewsburyandGitHub fe17cb6eba Fix fileglob parameter order bug (#72879) 2020-12-08 16:31:34 +01:00
David ShrewsburyandGitHub be2c376ab8 Extract embedded function to RoleMixin method and add tests (#72754)
* Add changelog
* Simplify return
2020-12-07 13:07:23 -05:00
David ShrewsburyandGitHub 0fa1cd88ce ansible-doc: replace DataLoader with from_yaml (#72686)
* Replace DataLoader with pure yaml
2020-11-23 13:32:03 -05:00
David ShrewsburyandGitHub 570aed0913 ansible-doc role arg spec support (#72120)
* Support listing roles in text and JSON

* Change tests for unfrack'd playbook_dir var

These tests were using '/tmp' for testing the setting of the playbook_dir
var. Now that we unfrack that var, MacOS will change this to '/private/tmp'
causing the tests to fail. We can choose a path that does not exist (since
unfrack does not validate existence) so that we can guarantee unfracking
will not change the value.
2020-11-17 12:58:19 -05:00
David ShrewsburyandGitHub f2f6c34632 Fix play stats when rescue block is a child block (#70922)
* check run state of current block only

* Add changelog and test

* Add test for issue 29047

* Fix for both tests

* blerg

* Change test messages

* fix tests

* Add multi-level block in rescue test case

* Add recursive rescue check and multi-level test

* Should probably run the new test

* ci_complete

* Merge new tests

* ci_complete
2020-08-18 11:20:55 +02:00
David ShrewsburyandGitHub 2f77606aa1 Add CVE reference to changelog for PR 70762 (#71151) 2020-08-07 10:55:09 -05:00
David ShrewsburyandGitHub 6bf1dd428b Update 70762 changelog to use security_fixes (#71124) 2020-08-06 14:58:56 -05:00
David ShrewsburyandGitHub bf98f031f3 Sanitize URI module keys with no_log values (#70762)
* Add sanitize_keys() to module_utils.

* More robust tests

* Revert 69653 change

* Allow list or dict

* fix pep8

* Sanitize lists within dict values

* words

* First pass at uri module

* Fix insane sanity tests

* fix integration tests

* Add changelog

* Remove unit test introduced in 69653

* Add ignore_keys param

* Sanitize all-the-things

* Ignore '_ansible*' keys

* cleanup

* Use module.no_log_values

* Avoid deep recursion issues by using deferred removal structure.

* Nit cleanups

* Add doc blurb

* spelling

* ci_complete
2020-07-22 14:49:37 -05:00
David ShrewsburyandGitHub 8aca464b8b Make sure ansible_become treated as a boolean (#70484)
* Make sure ansible_become treated as a boolean
2020-07-08 14:53:38 -04:00
David ShrewsburyandGitHub 4e41e37aa7 Fix flatten null perserve versionadded (#70435) 2020-07-02 13:28:39 -05:00
David ShrewsburyandGitHub dd07bdf22d Fix galaxy role info bug to support multiple roles (#70148)
* Add changelog fragment
* Update changelog
2020-06-23 16:57:25 -04:00
David ShrewsburyandGitHub fc448ea54f Clarify blockinfile docs for insertafter/insertbefore (#69396)
* Clarify blockinfile docs for insertafter/insertbefore

It's not clear from the docs that these options take effect
only when no marker lines are found in the document.

* Add changelog fragment
2020-06-16 14:48:08 -04:00
David ShrewsburyandGitHub 0ae4dac65a Fix copy module file perms with remote_src (#69993)
When using 'remote_src: yes' and 'mode: preserve', the code handling
the file modes has to be handled on the remote node because it's
the one that has access to the source files. This means that the
copy module itself must handle this, rather than the copy action
plugin (which is where all that logic exists). The copy module
handles this when we copy a single file over. But when it is a
directory as the src parameter value, the mode of the files
beneath it are not considered. Subdirectories are copied with
shutil.copytree() which will preserve permissions automatically.
Individual files are copied with shutil.copyfile() which does NOT
preserve permissions. We need to add some calls to shutil.copymode()
to correct that.

Note: This *always* retains individial file permissions. Specifying
a 'mode' other than 'preserve' when giving a source directory for
the 'src' param does not make sense so will be ignored in that case
only.

Fixes #69783

* Add changelog and test
2020-06-11 15:18:59 -04:00
David ShrewsburyandGitHub 2d394382cf Reap collections changelog fragments - 6 (#69491) 2020-06-02 11:39:46 -05:00
David ShrewsburyandGitHub 1142faa213 Do not pass file mode during recursive copy on symlink files. (#69011)
* Do not pass file mode during recursive copy on symlink files.

The 'file' module cannot deal with mode=preserve. Do not pass that
mode to the module when 'preserve' is used.

* Fix changelog fragment filename
2020-04-30 14:22:16 -05:00
David ShrewsburyandGitHub ff47d3f766 Make sure collection is a list if a str is given (#69081)
* Make sure collection is a list if a str is given

* Call field validation early on collections

Because we are doing work on modifying the collections value before
it is actually validated, we can validate it ourselves early to make
sure the user supplies either a string or list. Dicts are not valid.

The new validation allows us to simplify the _ensure_default_collection()
function. And since the field is now static, we no longer need to specify
a default for it, which also allows us to simplify the function. Since
the default is now removed, we can also remove the sanity/ignore.txt entry
for collectionsearch.py.

New unit tests are added (and the existing one modified) that allow us to
make sure that we throw a parser error if a user specifies something other
than a string or list for the collections value everywhere it can be specified.

* Revert removing the collection default

The default is actually used, so restore it.

* Fix unit tests in test_helpers.py affected by early collection validation
2020-04-28 10:47:11 -05:00
David ShrewsburyandGitHub af44bd4ddd Fix --start-at-task when skipping tasks with no name (#68951)
Using --start-at-task on a playbook with tasks with no name would fail
if those unnamed tasks were encountered before the targetted start task.
2020-04-21 09:39:17 +02:00
David ShrewsburyandGitHub 18a66e291d Force collections to be static (#68723)
* Force collections to be static

Templating of collection names does not work at all. Force them to
be static so that a warning is generated for the user.

* Add collectionsearch unit test and fix for reviews

New unit test validates the new _load_collections() code and moves
the new check to the end of the method.

* Change unit test to pytest

* Adjust unit test to use capsys instead of monkeypatch

* Fix pep8 error

* Add changelog fragment

Closes #68704
2020-04-13 11:53:05 -05:00
David ShrewsburyandGitHub d4d2c95819 Update team_openstack in botmeta (#68679)
* Update team_openstack in botmeta

* Also add an ignore for Shrews
2020-04-07 16:47:26 -05:00
David ShrewsburyandGitHub 83d767ca37 Merge pull request #20832 from Logan2211/os-network-provider-types
os_network: Allow freeform provider_network_type string
2017-01-30 15:34:13 -05:00
David ShrewsburyandGitHub c950767898 Merge pull request #19320 from manics/ansible-modules-core/pull/5176
Allow creation of Openstack volumes from an existing volume
2017-01-27 10:12:00 -05:00
David ShrewsburyandMatt Clay b928ffb5ac New OpenStack module os_port_facts (#1986) 2016-12-08 11:34:05 -05:00
David ShrewsburyandMatt Clay d0f7af4b09 Fix os_network's create_network() call for older shade versions (#5058)
A value for the project_id parameter to shade's create_network()
call was always being sent, even if no value for 'project' was
supplied. This was breaking folks with older versions of shade
(< 1.6).

Fixes PR https://github.com/ansible/ansible-modules-core/issues/3567
2016-12-08 11:25:14 -05:00
David ShrewsburyandMatt Clay 56211bd7ed Correct reuse_fips param to reuse_ips (#4939)
This new parameter was incorrectly named. Fixing to match the expected
name in the shade library.
2016-12-08 11:25:12 -05:00
David ShrewsburyandMatt Clay 37edf33955 Fix bug in os_router.py when router is not actually updated. (#4107)
The shade update_router() call will return None if the router is
not actually updated. This will cause the module to fail if we
do not protect against that.
2016-12-08 11:24:43 -05:00
David ShrewsburyandMatt Clay 530fd1365a Allow os_server to delete FIP (#3509)
The os_server module could automatically generate a floating IP for
the user with auto_ip=true, but we didn't allow for this FIP to be
automatically deleted when deleting the instance, which is a bug.
Add a new option called delete_fip that enables this.
2016-12-08 11:24:42 -05:00
David ShrewsburyandMatt Clay dcbbd72cfd Wrap calls to main() with if check
A change was merged to the main Ansible core code that can cause

a potential hang if any libraries are called that use threading.

This change was:

  https://github.com/ansible/ansible/commit/4b0aa1214ca989c71bb87f7a805b1e3673faefa9

This affected the os_object module by causing a hang on the shade

create_object() API call (which in turn calls swiftclient which

uses threading). The fix is to make sure all modules have a main()

that is wrapped with an "if __name__ == '__main__'" check.
2016-12-08 11:24:16 -05:00
David ShrewsburyandGitHub 7b6c35f133 Merge pull request #17241 from Shrews/changelog
Update CHANGELOG for new os_server_group module
2016-08-25 08:08:34 -04:00
David ShrewsburyandBrian Coca bf8c871801 Fix async logic when parsing fails (#17091)
We want to NOT consider the async task as failed if the result is
not parsed, which was the intent of:

  https://github.com/ansible/ansible/pull/16458

However, the logic doesn't actually do that because we default
the 'parsed' value to True. It should default to False so that
we continue waiting, as intended.
2016-08-15 13:29:06 -04:00
David ShrewsburyandBrian Coca 73f06e67df Update CHANGELOG for new os_zone and os_recordset modules (#16847) 2016-07-27 18:42:32 -04:00
David ShrewsburyandBrian Coca f101910167 Update CHANGELOG for os_keystone_service module (#16190) 2016-06-08 10:35:47 -04:00
David ShrewsburyandBrian Coca 6a3b6ef2c7 Update CHANGELOG for new os_project_facts module (#15406)
New OpenStack module os_project_facts.
2016-04-13 14:49:31 -04:00
David Shrewsbury 22467a0de8 Merge pull request #15232 from donovan/fix-openstack-config-file-name
add openstack.yml to CONFIG_FILES to be consistent with documentation
2016-04-12 22:29:45 -04:00
David Shrewsbury 5ade16add0 Merge pull request #15392 from Shrews/changelog
Update CHANGELOG for new os_port_facts OpenStack module
2016-04-12 15:12:31 -04:00
David ShrewsburyandBrian Coca 51ea02e580 Add new OpenStack modules (#15371)
Added os_keystone_domain_facts and os_user_facts modules.
2016-04-11 16:34:20 -04:00