* pacman: rewrite with a cache to speed up execution
- Use a cache (or inventory) to speed up lookups of:
- installed packages and groups
- available packages and groups
- upgradable packages
- Call pacman with the list of pkgs instead of one call per package (for
installations, upgrades and removals)
- Use pacman [--sync|--upgrade] --print-format [...] to gather list of
changes. Parsing that instead of the regular output of pacman, which
is error prone and can be changed by user configuration.
This can introduce a TOCTOU problem but unless something else calls
pacman between the invocations, it shouldn't be a concern.
- Given the above, "check mode" code is within the function that would
carry out the actual operation. This should make it harder for the
check code and the "real code" to diverge.
- Support for specifying alternate package name formats is a bit more
robust. pacman is used to extract the name of the package when the
specified package is a file or a URL.
The "<repo>/<pkgname>" format is also supported.
For "state: latest" with a list of ~35 pkgs, this module is about 5
times faster than the original.
* Let fail() actually work
* all unhappy paths now end up calling fail()
* Update copyright
* Argument changes
update_cache_extra_args handled as a list like the others
moved the module setup to its own function for easier testing
update and upgrade have no defaults (None) to let required_one_of() do
its job properly
* update_cache exit path
Shift successful exit without name or upgrade under "update_cache".
It is an error if name or upgrade isn't specified and update_cache wasn't specified
either. (Caught by ansiblemodule required_one_of but still)
* Add pkgs to output on success only
Also align both format, only pkg name for now
* Multiple fixes
Move VersionTuple to top level for import from tests
Add removed pkgs to the exit json when removing packages
fixup list of upgraded pkgs reported on upgrades (was tuple of list for
no reason)
use list idiom for upgrades, like the rest
drop unused expand_package_groups function
skip empty lines when building inventory
* pacman: add tests
* python 2.x compat + pep8
* python 2.x some more
* Fix failure when pacman emits warnings
Add tests covering that failure case
* typo
* Whitespace
black failed me...
* Adjust documentation to fit implicit defaults
* fix test failures on older pythons
* remove file not intended for commit
* Test exception str with e.match
* Build inventory after cache update + adjust tests
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/os/pacman.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* changelog
* bump copyright year and add my name to authors
* Update changelogs/fragments/3907-pacman-speedup.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* maintainer entry
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added new feature for ansible_user and ansible_port
* Replaced 'try' and 'except' with 'if' condition
* Replace '!=' with 'is not'
* Fixed if condition
* Implement the constructed interface
* Correction at the suggestion of felixfontein
* Added new options in unit test for icinga2 inventory
* Added blank lines in unit test for icinga2 inventory
* Added default filter in example
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fixed variable name in example
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added a changelog fragment
* Fixed changelog fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
* Updated documentation options
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* linode: Allow templating token for dynamic inventory
Template the value for the access_token if it's a Jinja template.
Allows for looking up tokens from files or pulling from secrets stores like Vault.
* add Linode changelog fragment
* Fix lookup example for newer versions of Ansible
Co-authored-by: Felix Fontein <felix@fontein.de>
* Rename test case for clarity
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* nmcli: add wireguard connection type
* nmcli: fix wireguard unit tests
* nmcli: set ipv4.method to disabled if ip4 not set
Method 'auto' is not supported for WireGuard
* nmcli: add wireguard documentation
* nmcli: clean up wireguard documentation
* nmcli: add wireguard changelog fragment
* nmcli: fix wireguard documentation
* Apply suggestions from code review
Co-authored-by: Andrew Pantuso <ajpantuso@gmail.com>
Co-authored-by: Andrew Pantuso <ajpantuso@gmail.com>
* LXD 4.x compatibility (Containers and VMs)
* add changelog fragment
* update fixture
* update plugin options
* backwards compatible alias
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/3519-inventory-support-lxd-4.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* add lxd 4.0 requirement
* filter for type of virtualization added. due to duplication in the namespace, "type" is not used as the keyword but "nature".
* add type filter
Since the first version of this inventory plugin only supports containers,
a filter function was added to filter between containers and
virtual machines or both.
By default only containers are displayed, as in the first version of the plugin.
This behavior will change in the future.
* rename C(nature) to C(type)
The term "nature" does not fit into the lxd namespace.
Therefore i renamed nature to type.
* update changelog fragment
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* rename typefilter to type_filter
* fix tests with type_filter
* Update plugins/inventory/lxd.py
* Update plugins/inventory/lxd.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Frank Dornheim <“dornheim@posteo.de@users.noreply.github.com”>
* rebase
* Add changelog fragment
* add suggestions
* split PR into two
* Add multiple address support but with #3768 fiexed
* rebase
* clean some merge artifacts
* update the wording
* interfaces_file: fixed unit tests and added README, added test cases for #3862
* typo fix for interfaces_file unit tests README.md
Co-authored-by: Felix Fontein <felix@fontein.de>
* typo fix for interfaces_file unit tests README.md
Co-authored-by: Felix Fontein <felix@fontein.de>
* typo fix for interfaces_file unit tests README.md
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add support for addr-gen-mode and ip6-privacy options
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* try to solve conflict
* add suggested code + fix some of its issues
* Update plugins/modules/net_tools/nmcli.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* monit - invoke run_command passing list
* added changelog fragment
* fixed unit test
* further adjustments
* fixed handling of command_args
* better handling of command_args
* change ip6 type to list of str and fix problem with setting addresses without netmask
* change ip6 type to list of str and fix problem with setting addresses without netmask
* Add changelog fragment
* add suggestions
* fix no mask using bug
* Make change independed from feature branch
* Xen orchestra inventory: Added groups, keyed_groups and compose support
* Update plugins/inventory/xen_orchestra.py
Remove extra params declaration
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* wip
* Renamed xo env variable with ANSIBLE prefix
* Suppress 3.x import and boilerplate errors
* Added shinuza as maintainer
* Do not use automatic field numbering spec
* Removed f string
* Fixed sanity checks
* wip tests
* Added working tests
* Fixed a bug when login fails
* Update plugins/inventory/xen_orchestra.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* change ip4 type to list of str
* Add several tests and change documentation
* Update changelogs/fragments/1088-nmcli_add_multiple_addresses_support.yml
Co-authored-by: Andrew Pantuso <ajpantuso@gmail.com>
Co-authored-by: Andrew Pantuso <ajpantuso@gmail.com>
* Added redis_incr module
Added redis_incr module and unit tests for the module.
Added suggested changes to increment_float, increment_int stuff
* rebased to main, version fix and unit test fix
* Renamed module,added check_mode and fixed retun value
* Update .github/BOTMETA.yml
* check_mode fix and version bump
* fix for lower Redis versions
* Update plugins/modules/database/misc/redis_data_incr.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* [callback][elastic] enrich span with http attributes
* [callback][opentelemetry] fix linting
* [callback][opentelemetry] fix UTs
* [opentelemetry][changelog] add fragment for the service map feature
* Update plugins/callback/opentelemetry.py
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
* [opentelemetry][callback] remove comments
* [opentelemetry][callback] fix UTs
* [opentelemetry][callback] return the value
otherwise a None value returns ParseResultBytes when using urlparse(None)
* [opentelemetry][callback] fix wrong parameter order
* [opentelemetry][callback] support for no interpolated URLs
* [opentelemetry][callback] support for URLs without interpolation in the hostname
* [opentelemetry][callback] fix linting
* Update changelogs/fragments/3558-callback_opentelemetry-enrich_service_map.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Ajpantuso <ajpantuso@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add elastic callback plugin
* Capture task failures
* Catch errors and add UTs
* Skip 3.5< python versions and install dependency
* fix lint
* Fix linting
* Fix linting
* Add botmeta
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* It's not required
* As suggested in the code review OrderedDict has been added to the Python stdlib since version 2.7
* Update plugins/callback/elastic.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* [ufw] Insert or delete biased when deletion enabled - as for append or delete.
* Started creating Unit tests for Proxmox Tasks module
* Tried really hard to get the mock to work
* unit tests for the module
* Fixed symslink and permissions
* Suggested changes and more unit tests
* Fixed isFalse
* Apply suggestions from code review
* Update plugins/modules/cloud/misc/proxmox_tasks_info.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Updated nmcli.py
Amended the routing-rules4 values as list. By this we could add the entries for "routing_rules4" in the form of a list .
* Update nmcli.py
Fixed typo in line #1701
* 3395-nmcli-needs-type.yml
routing_rules4 module argument is currently accepting only string elements. In order to accept multiple values, amended the type of routing_rules4 as list.
* nmcli: amended the routing-rules4 key values as list
routing_rules4 module argument is currently accepting only string elements. In the case of adding multiple entries to routing_rules4, we need to accept values as list.
* Added 3401-nmcli-needs-type.yml
routing_rules4 module argument is currently accepting only string elements. In the case of adding multiple entries to routing_rules4, we need to accept values as lists
* Amended type to 'minor_changes'
Amended type to 'minor_changes' from 'bug_fixes'
* routing_rules4 to a list of element str
nmcli.py - routing_rules4 to a list of element str
* Update changelogs/fragments/3401-nmcli-needs-type.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* nmcli: allow routing-rules4 key values as list
* nmcli: amended the routing-rules4 key values as list
* nmcli: amended the routing-rules4 key values as list
* nmcli: amended the routing-rules4 key values as list
* test_nmcli: amended whitespaces
* Update 3401-nmcli-needs-type.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added OpenNebula inventory plugin
Signed-off-by: Kristián Feldsam <feldsam@gmail.com>
* Apply suggestions from code review
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Removed matching inventory yaml files ending with "one"
Too general word
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
* Added BOTMETA
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
* Moved import
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
* Fix indentation problem
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
* Added group_by_labels, refactored so can be unit tested
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
* Added unit tests
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
* Removed blank line
Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* Restrict to unit tests with devel (to be reverted later).
* Restrict lxml for Python 2.6.
* Revert "Restrict to unit tests with devel (to be reverted later)."
This reverts commit d0d87a8a0f.
* Added redis_set module
Added redis_set module and unit tests for the new module.
Applied suggested changes and removed redis_del in favor of state
option.
Also added redis utility class that handles connection.
* Typos, added version and BOTMETA
* Fixed import error checking
* Fixed Unit tests
* Docfix and return consistency
* Added Check Mode
* Update plugins/modules/database/misc/redis_data.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* pythonific!! no camel cases, bitte
* simplified iface attributes parsing
* some improvements, passing tests
* simplified set_interface_option()
* further simplifications
* remove unreachable stmt
* pythonified a file open
* added changelog fragment
* adjustment per PR
* PR: fixed the auto- case
* PR: added testcase and chglog frag for the misleading change report
* extra line removed
* integration is not destructive
* Add opentelemetry callback plugin
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Formatting (text), booleans and renamed env variables
* This should be done in a future release
* Remove insecure in favour of the OTEL env variable. Add descriptions
* Use OpenTelemetrySource
* Move generate_distributed_traces
* Move update_span_data and set_span_attribute
* Move finish_task
* Move start_task
* Refactor to support UTs
* Add first UT
* Fix codestyle
* opentelemetry callback entry in the botmeta
* Fix linting
* Fix signature
* Mock methods
* Use MagicMock
* Mock the methods
* UT for transform_to_boolean_or_default
* Fix linting
* Set test data
* Mock _time_ns
* Exclude tests for python <= 3.6
* Remove obsoleted setup task type configuration
* Remove unused docs
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fix docs
* unrequired logic that was originally took from https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/junit.py\#L226
* Use raise_from for the required dependencies
* Fix linting
* Add requirements for the UTs
* add missing dependency for the opentelemetry plugin in the UTs
* Add ANSIBLE_ prefix for the ansible specific options
* Add more context in the docs and remove duplicated docs
* As suggested in the code review
* Verify if the OTEL env variables for the endpoint were set
* Fix docs typo
* Fix linting
* Revert "Fix linting"
This reverts commit 3a54c827c5472553a6baf5598bc76a0f63f020c1.
* Revert "Verify if the OTEL env variables for the endpoint were set"
This reverts commit cab9d8648899c28c0345745690c4ec7a41f7e680.
* Remove console_output as suggested
* Apply suggestions from code review
Co-authored-by: flowerysong <junk+github@flowerysong.com>
* Delegate the definition of OTEL_EXPORTER_OTLP_INSECURE to the user
* Move definitions above, close to the class that uses them
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: flowerysong <junk+github@flowerysong.com>
* Adds few more gitlab group options
* Update plugins/modules/source_control/gitlab/gitlab_group.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Removes default for new string options
* Removes default from argument_spec
* Adds changelog fragment
* Update plugins/modules/source_control/gitlab/gitlab_group.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/source_control/gitlab/gitlab_group.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/source_control/gitlab/gitlab_group.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Maik Schueller <maik.schueller@sap.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added redis_data_info module
Added:
- redis_data_info module and suggested 'exists' return flag.
- module_utils for redis with a base class that handles database connections.
- inhereited unit tests and added some new ones for the exit flag
* Docfix and sanity
* typo
* Suggested doc changes and ssl option
* TLS and validate_certs fix
* Set support_check_mode for info plugin
* Docfix and import errors
* Redis versioning Fix
* version bump and append fixes