* Added module for ipa_otpconfig
* Make no_log=False explicit.
* Updated inputs to be int type instead of strings to align to expected inputs. Updated output message
* Add changelog fragment
* Remove changelog fragment as this is a new module
* Update plugins/modules/identity/ipa/ipa_otpconfig.py
Add version_added field to module description.
Co-authored-by: Felix Fontein <felix@fontein.de>
* Updated punctuation in examples
* Add unit test for ipa_otpconfig
* Add ipa_otptoken module with unit test
* Updated documentation in unit test
* Update plugins/modules/identity/ipa/ipa_otpconfig.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/ipa/ipa_otpconfig.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/ipa/ipa_otptoken.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/ipa/ipa_otptoken.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/ipa/ipa_otptoken.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/ipa/ipa_otptoken.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/ipa/ipa_otptoken.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/ipa/ipa_otptoken.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added some documentation updates to make it conform to ansible standards
* Update plugins/modules/identity/ipa/ipa_otptoken.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Address review comments
Co-authored-by: Chris Costa <chris.costa@compellingtech.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Bugfix: PyGithub does not support explicit port in base_url
* Fix unit tests
* Fix unit tests
* Added changelog
* Update changelogs/fragments/2204-github_repo-fix-baseurl_port.yml
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* replace inline clear password by environment variable on a per-command basis.
* add changelog fragment
* update related unit tests
* Update changelogs/fragments/2177-java_keystore_1668_dont_expose_secrets_on_cmdline.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix unit test: force result without lambda
Co-authored-by: Felix Fontein <felix@fontein.de>
* added metadata for variables in module helper
* adjustments
* added separate support for tracking changes
* rewrote the diff code
* added integration test for module_helper
* using ansible.module_utils.common.dict_transformations.dict_merge
* improved dependency management
* restore ModuleHelper to base classes of CmdStateModuleHelper
* added assertions to ensure the failing module name appears in the error messages
* added test code for state-based modules
* fixed test name
* renamed class to VarMeta
* small fixes
* fixes from the PR
* fixed VarDict.__set_attr__
* added VarDict.__getitem__()
* added changelog fragment
* adjustments per PR
* ModuleHelper.output is now aware of conflicting variable names
* Update plugins/module_utils/module_helper.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* improve temporary files storage (naming/removal)
* update unit tests
* Update changelogs/fragments/2163-java_keystore_1667_improve_temp_files_storage.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* add dedicated function to randomize PKCS#12 filename
fix unit tests (also mock the new function)
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add support for `sudo su -` using password auth
Allow users to run Ansible tasks through `sudo su -` using password auth
- Feature Pull Request
sudosu
So I have been using this at various customers for bootstrapping Ansible mostly.
Often you have an existing setup where there is a user that has root-access enabled through sudo, but only to run `su` to log using the user's password.
In these specific cases the root password is unique to the system and therefore not an easy way to automate bootstrapping.
Having a `sudo su -` become option **with password prompt** is not possible with the existing become methods (neither sudo nor su can be used) by abusing `become_exe` or `become_flags`.
This fixesansible/ansible#12686
* Fix all reported issues
* Add unit tests
* Apply suggestions from code review
* Update plugins/become/sudosu.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update tests/unit/plugins/become/test_sudosu.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update tests/unit/plugins/become/test_sudosu.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* add new module xcc_redfish_command to manage Lenovo servers using Redfish APIs
* Update plugins/modules/remote_management/lenovoxcc/xcc_redfish_command.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix some errors detected by ansible-test sanity
* end all descriptions (except short_description) with a period
* fix return definition problem and other errors detected by ansible-test sanity
* Always use true/false for booleans in YAML
* It is usually a good idea to leave away required: false
* fix errors detected by ansible-test sanity
* fix elements of command is not defined
* check whether resource_uri is specified for Raw commands
* if no Members property, return false; if empty array, return true
* get @odata.etag from patch body instead of getting again
* add request_body checking
* add unit test for the module
* fix errors detected by ansible-test sanity --test pep8
* update class name xcc_RedfishUtils to XCCRedfishUtils to follow convention; import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args, exit_json, fail_json from ansible_collections.community.general.tests.unit.plugins.modules.utils instead of inline them
* support using security token for auth
* fix line too long error
* As 2.3.0 got released yesterday, move to 2.4.0
* add maintainers for lenovoxcc
* update to make sure that it's sorted alphabetically
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added from_csv filter and integration tests
* Cleaning up whitespace
* Adding changelog fragment
* Updated changelog fragment name
* Removed temp fragment
* Refactoring csv functions Part 1
* Syncing refactored csv modules/filters
* Adding unit tests for csv Module_Util
* Updating changelog fragment
* Correcting whitespace in unit test
* Improving changelog fragment
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/2037-add-from-csv-filter.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Improvements and fixes to ModuleHelper, with (some) tests.
* added changelog fragment
* adjusted changelog frag - get_bin_path() handling is actually a bugfix
* Included explicit parsing for proxmox guest tags and updated corresponding unit test with tags key
* Including changelog fragment for PR 1949
* Removed ellipsis from test
Proxmox only permits periods when surrounded by alphanumeric characters
* Corrected punctuation for changelog entry
Co-authored-by: Felix Fontein <felix@fontein.de>
* Allowing tags string to contain commas
* Incorporated new parsed tags fact with bugfix
* Correcting whitespace issues
* Update changelogs/fragments/1949-proxmox-inventory-tags.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/inventory/proxmox.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/1949-proxmox-inventory-tags.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Jenkins build module
A module for queuing and deleting jenkins builds.
* CI fixes
* More CI fixes.
* Even more CI fixes
* Fixing symlink
* Update plugins/modules/web_infrastructure/jenkins_build.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* removed ansible meta section
* Added unit tests.
* fix tests
* more test fixes.
* Completed tests.
Mocked jenkins api calls.
Fixed some logging.
* Update plugins/modules/web_infrastructure/jenkins_build.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/web_infrastructure/jenkins_build.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/web_infrastructure/jenkins_build.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/web_infrastructure/jenkins_build.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Cleaned up default items
And removed supports check mode flag.
* setting name param required
* Update plugins/modules/web_infrastructure/jenkins_build.py
Co-authored-by: Brett Milford <brettmilford@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update targets for CI for devel branch; move some targets to stable-2.10.
* Skipping test on RHEL 8.3 (it is already skipped on RHEL 8.2).
* Linting.
* Shut 2.9/2.10 pylint complaints up.
* fixes various issues related to updating an ...
... existing gitlab user, in detail:
- fixes updating admin status not working
- fixes user passwords not updated
- fixes confirmation skipping param ignored for user updates
- added tests for code changes
* fixing sanity issues
* fixing sanity issues 02
* fixing sanity issues 03
* fixing sanity issues 04
* fixing unit test failures
* fixing unit test failures 02
* add changelog fragment
* fixing unit test failures 03
* forgot to add changelog fragment
* fix changelog sanity issues
* fix changelog sanity issues 02
* incorporate review suggestions
Co-authored-by: Mirko Wilhelmi <Mirko.Wilhelmi@sma.de>
* Fix 2 regex in parted related to parted version string and to parsing partition size output.
* Added changelog fragment.
* Updated changelog as per recommendation.
* Fix the regex matching the parted version. The space character at the end of the string may or may not be always present
* provided sample version output and corrected regex to match
* add/correct changelog fragment
* split parted_version function to allow creating a test unit
* test unit for parted version info
* ansible-test sanity fixes
* review fix
* Update changelogs/fragments/1695-parted-updatedregex.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
* comment fixes
* better function name
* Update plugins/modules/system/parted.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* comment fixes
Co-authored-by: Claude Robitaille <claude@cbcr.me>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add tags filter to linode inventory plugin
* add tags to return tuple on line 66 in test_linode.py
* Add period in changelog fragment.
use if any() rather than for ... if list completion
* Clarify the description of the ``tags`` option
* Updated description to remove syntax error of line break.
* Improvements in module_helper
- added `ModuleHelperException` to handle problems specific to ModuleHelper
- updated `module_fails_on_exception` for `ModuleHelperException`
- `StateMixin`: composed names of state methods are now calculated instead of fixed.
- `CmdMixin`: added `run_command_fixed_options` to pass some parameters on every call
* Improvements in module_helper
- Named deprecations: ability to declare a `dict` of deprecations indexed by names, allowing module maintainer to trigger them by those names, and also allowing the module user to acknowledge them in a similar way.
- Adding `ack_named_deprecations` to module's `argument_spec` when they exist.
- Providing doc fragment for `ack_named_deprecations`.
- Added method `__quit_module__` providing a hook for code that needs to be run when quitting the module.
- Created convenience classes combining `ModuleHelper`, `StateMixin`, `CmdMixin`.
* fixed validation
* fixed validation
* changelog fragment
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Improvement on Named Deprecations
Per the comments in PR, we want to expose a call to a ``deprecate`` method on the module code, so that pylint can properly perform its static analysis on deprecations.
This prompted a revamp of the named deprecation feature.
* Use .get() instead of [] for the param to ack named deprecations.
* Changes from suggestions in the PR
* removed named deprecations
* Update changelogs/fragments/1480-module-helper-improvements.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/module_utils/module_helper.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Provide a user friendly message by handling json decode
exception rather than providing a stacktrace
Fixes: #1614
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Add ipa_pwpolicy module
Used for modifying FreeIPA password policies
Functions similarly to the existing IPA modules
* Add sample return value to ipa_pwpolicy module
* Add unit tests for the ipa_pwpolicy module
Also moves the `exit_json` call in the main module outside of the try
clause because it was stopping the tests from working
* Update version added for the ipa_pwpolicy module
* Add check_mode note for the ipa_pwpolicy module
* Add missing period in ipa_pwpolicy module doc
* Fix tense of the ipa_pwpolicy module description
* Reword ipa_pwpolicy documentation
Improve the wording of the ipa_pwpolicy documentation to make it more
clear
* Rename ipa_pwpolicy options to use shorter names
* Remove kubevirt and set up redirects to community.kubevirt
This also removes the dependency on community.kubernetes which fixes
https://github.com/ansible-collections/community.general/issues/354.
* Update changelogs/fragments/1317-kubevirt-migration-removal.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/1317-kubevirt-migration-removal.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add missed redirects
Co-authored-by: Felix Fontein <felix@fontein.de>
* add support for all monit service types
* ignore case when performing check
* add changelog
* Escape special characters before matching
Co-authored-by: Felix Fontein <felix@fontein.de>
* escape each element individually
Co-authored-by: Felix Fontein <felix@fontein.de>
* Remove Google cloud plugins migrated to community.google
* Remove another symlink
* Fix typo for community.general version
* Update changelogs/fragments/1319-google-migration-removal.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/1319-google-migration-removal.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add fragment for inventory script
* fix yaml formatting
* adjust past relnotes in accordance with removal of google plugins
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fresh branch to try this again
* Fix typo
* Fix sanity error
* Redid some tests, not sure if this works...
* Re-fixed documentation
* Fixed linter
* Update layout
* Processed feedback
* Processed feedback
* Added check_mode
* Run test with check mode
* Fix layout
* Fix more layout
* Fixed last sanity errors (for now)
* Check mode is not a module arg..
* Fix sanity-error
* Reworked check_mode and adapted tests
* Added extra test to also run through remove logic, added message for check_mode to show output is different, grabbed magicmock from different library to fix py2 errors
* Remove unused function
* Processed feedback
* Processed feedback
* Processed feedback
* Fix 2.9/2.10 cloud
* Fix splunk callback tests.
* ansible_virtualization_type on AZP can be one of container/containerd instead of docker for dockerized tests.
* Disable nomad tests.
* Work around AZP bugs.
* xfconf: add return values and expand test coverage
* fix pep8
* fix pylint
* fix returns yaml docs
* Add changelog fragemnt
* revert docts for `returned`
* Update changelogs/fragments/1419-xfconf-return-values.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/xfconf.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* update return values to raw for scalar/lists
* another doc tweak: None -> none
* Break newline for pep8
* Fix merge mistake
* Back to list of strings
* fix yaml syntax
* Fall back to old way, deprecate returns, add ingores for errors
* add a note about dprecating facts
* Add depracation messages and fix docstring error
* remove deprecation of return values.
* Update plugins/modules/system/xfconf.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* drop the deprecation message too
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add millisecond data to timestamp
* Add flag to control splunk milliseconds
* Update changelogs/fragments/1462-splunk-millisecond.yaml
Co-authored-by: Amin Vakil <info@aminvakil.com>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply more suggestions from review
* Whitespace
Co-authored-by: Amin Vakil <info@aminvakil.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Bump version to 2.0.0.
* Remove deprecated 2.0.0 features.
* Test for failure.
* Fix cache plugin unit tests.
* Accept direct import only for Ansible 2.9.
* Fix typo in redhat_subscription testcase
* Fix macports state=present matching against the wrong package name
Previous implementation returned true if the desired package name occurred anywhere in
the list of all installed packages. For example as a substring of another package name,
or even as a substring of a variant name for a different package.
Instead:
- request macports only list installed packages matching the desired package name, instead of all installed packages.
- Note `port` exits with 0 regardless of whether any packages match the requested name.
- pass `-q` flag: "Do not print the header line. This is useful when parsing the output of port installed in scripts for further processing."
- eliminate `use_unsafe_shell=True` by searching stdout contents natively in python
instead of using `grep`. This has the added benefit of eliminating any potential
misinterpretation of characters in the package name as regex special characters.
If there are zero matching installed packages, `out` is empty.
If there are one or more matches (due to multiple installed versions), the output format
is: ec8a2bc682/src/port/port.tcl (L3320-L3323)
Notably, two leading spaces, the package name, a space, and then other information.
According to blame via github, those lines haven't changed in 11 years.
* Update macports state=active to eliminate use_unsafe_shell
Similar to previous commit (for macports state=present):
- pass `-q` flag: "Do not print the header line. This is useful when parsing the output of port installed in scripts for further processing."
- search stdout contents natively in python instead of using `grep`.
- added parentheses to search string to eliminate false positives if the package name
or variants contain the word `active`. Still could fail if they contain `(active)`, but
that's less likely
If there are zero matching installed packages, `out` is empty.
If there are one or more matches (due to multiple installed versions), the output format
is: ec8a2bc682/src/port/port.tcl (L3320-L3323)
For "state=active", we're looking for a line that contains `(active)` in the output.
* Basic test case of query_port for present and active
* Attempt to fix lint errors in test
* Different mock module creation, changed test cases indentation/spacing
- picked the wrong mock code to cargo-cult. Thanks to felixfontein for this suggestion
- 4 space indentation on continuation line. I thought I had that originally, but it looks like my editor sabotaged me with mixed tabs/spaces
- Remove leading newline on multi-line test cases. I don't think it would make a difference, but I'd read up on how the python syntax works and want to more accurately represent macports output.
fingers crossed this addresses the known build errors
* Add changelog fragment
* Update tests/unit/plugins/modules/packaging/os/test_macports.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/1307-macports-fix-status-check.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* * pkgin query_package(..) understands now also package name with version (my-package-1.2nb123456). * pkgin query_package(..) will distinct between not-installed and not-found packages. * pkgin install_package(..) fails with proper error if a non-existing package is attempted to be installed.
* fixup ansibot comments
* add changelog fragment
* add example
* use more pythonic condition
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* remove extra dot between description and link to PR
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* fix file extension of changelog fragment
* add pkgin unit tests for query_package function
* fix pep8 issues
* use enum Flag instead mix of strings, bools and None as return value
* use IntEnum instead Flag to support Python versions >= 2.6
* fix pep8 and pylint errors
* use regular class instead enum to avoid issues with older Python releases
* fix comment
* remove the combined package state since without an IntFlag or Flag the usage of it would require to use logical operators
Co-authored-by: Erik van Nooijen <eric.vannooijen@tomtom.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Add ability to resize existing partition
* Add 'resize' flag to support backwards compatability, and allow partition reduction
* Add changelog fragment for #773
* Update changelogs/fragments/773-resize-partition.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/parted.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update resize flag with PR review comments
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/system/parted.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update default on resize flag in parted.py
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Big revamp in xfconf.py
- added plugin/module_utils/module_helper.py
- scaffold class for writing modules, beyond standard AnsibleModule
- automatic capture of exceptions
- easier dependency testing
- StateMixin to easily handle different behaviours for 'state' param
- CmdMixin to easily run external commands
- adapted test_xfconf.py
- the args for run_command are now lists instead of a string
- value and previous_value were not being tested before (because xfconf wasn't filling results - see below)
- added more tests: setting value to previous_value, getting non-existent property
- rewritten xfconf module, keeping the same results
- original module posted results as ansible_facts, this version still does it for compatibility, but also adds to the module result
* Added suggestions from the PR
* Added russoz as maintainer for the module_utils/module_helper.py file
* Formatting using printf-style requires special treatment
Strings not containing substitution tokens must work as well.
* Tidied up variables in module definition
* Tests with ArgFormat and DependencyCtxMgr
* pytest parameters must be in the same order, it seems
* improved testing for the DependencyCtxMgr
* fixed test for older pythons
* Moved changed property to improve readability
* Added testcase for state: absent and adjusted xfconf after it
* Fixed param name environ_update in run_command()
* added changelog fragment
* fixed tests after run_command param change
* Adjusted case in class names - transparent to users
* Adjustments to module code:
- No need to try/except everything, in fact it complicated debugging
- Replaced second call to xfconf.get() with xfconf.previous_value
* the actual test
* removed extraneous empty lines
* added changelog fragment
* rolled back removing the try/except around the main execution
* Update changelogs/fragments/1305-added-xfconf-tests.yaml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/xfconf.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Removed extraneous import
Co-authored-by: Felix Fontein <felix@fontein.de>