* value is not required when state is absent
* fix integration test. missing value
* fix condition
* add changelog fragment
* fail fast
* try required_if on suboptions
* revert
* Update plugins/modules/source_control/gitlab/gitlab_project_variable.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix naming in doc
* typo in name
Co-authored-by: Felix Fontein <felix@fontein.de>
* homebrew_cask: reinstall when force is install option
* add changelog entry
* Fix OSX CI runs - run as non-root
* test with cask that has no macos dependencies
* use `brooklyn` cask to test
* initial development of homectl module
* botmeta
* fix some linting
* Update .github/BOTMETA.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* use array form of run_command
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* added mofifying user record and cleaned up based on comments
* added updating records/multiple changes regarding options, examples doc, return doc
* add integration tests and more overall improvements
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* removed modify handle within present
* adding more options and better checking of user records when updating
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/system/homectl.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add code review changes
- remove unsafe_shell with run_command.
- use dict.pop() in user_metadata dict.
- consistent quoting to single quotes.
- change logic to determine check mode better
- fix integration tests and added check_mode tests
* Fix handling of mount opts
When a user is created without mountopts homed will use nodev and nosuid
by default, however the user record metadata will not contain these
values. This commit takes extra care that correct value is being set to
true or false. So if a user gives mountopts with just nodev we need to
make sure the nosuid and noexec gets set to false, etc. If mountopts are
same as currently in user record make sure nothing would be changed and
outputs correctly.
Also fixed some tests.
* change fmethod modify_user to prepare_modify_user_command
* Code review fixes and add existing user pw checking
- Added methods to check existing users password is correct by comparing
the hash stored in homed user record and the hash of given password
- Updated integration tests for above case
- Added aliases file so CI can run
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add functionality proposed in https://github.com/ansible-collections/community.general/issues/666
* Fix pylint errors mentioned in CI pipeline
* Fix pylint errors mentioned in CI pipeline (continued)
* Update plugins/modules/packaging/os/snap.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Added tests
Fixed error occurring when called without options
Added changelog snippet
* Remove changelog entry as suggested in review
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* rewrite `if len(overall_options_changed) > 0` in a more Pythonic way
un-indent `if len(overall_options_changed) > 0` to only be executed after the options of all snaps have been checked
* better placement of local variable `overall_options_changed`
* Re-arrange code to reduce indentation level (suggested by reviewer)
* Re-arrange code to reduce indentation level (suggested by reviewer, continued)
* Re-arrange code to reduce indentation level (suggested by reviewer, continued)
Raise exception if option map returned by `snap set` contains list container (suggested by reviewer)
Handle Python2 type `long` correctly (suggested by reviewer)
Co-authored-by: Felix Fontein <felix@fontein.de>
* Fix detection of installed cargo packages with hyphens in name
* Add changelog fragment
* Fix outdated package detection
* Add changelog fragment for af4fae72
* One more thing
* Add idempotency tests
* New module for cargo command
* Resolve CI errors
* Update plugins/modules/packaging/language/cargo.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/language/cargo.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/language/cargo.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add maintainer
* Change installed_packages from property to function
* Allow cargo to install list of of packages
* Remove period at the end of task names
* Pass only the list of packages to take action on to cargo
* Add integration tests for cargo
* Update plugins/modules/packaging/language/cargo.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Apply suggestions from code review
* Update tests/integration/targets/cargo/tasks/setup.yml
* Update tests/integration/targets/cargo/tasks/setup.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add module and pass the andebox validate-modules
* Fixes pep8 and sanity checks
* Add tests (intending that they'll fail)
* Fix pep8 complaint
* Remove stub test_sudoers file
* Add version_added to documentation
Co-authored-by: Andrew Pantuso <ajpantuso@gmail.com>
* Various improvements as suggested by reviewers
* Remove further required: false from documentation
* Make yaml indentation consistently indented
* Remove default for command argument
Co-authored-by: Andrew Pantuso <ajpantuso@gmail.com>
* Refactor check_mode checking as guards
* Update documentation formatting and use to_native
* Update plugins/modules/system/sudoers.py
* Update examples and formatting
* Fix merge conflict
* Update handle
* Add some integration tests
* Update tests to pass yamllint
* Fix assertions typo
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* Remove wrapping quotes from assertions
* Use >- for long example names
* Add aliases file to sudoers integration tests
* Fix integration test name
* Create new alternative sudoers directory in case /tmp doesn't exist
* Alternative assertion test for checking rule revocation
* Re-quote assertions
* Update version_added to 4.3.0
Co-authored-by: Felix Fontein <felix@fontein.de>
* Uppercase first character of short_description
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Andrew Pantuso <ajpantuso@gmail.com>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add counter filter
* move counter filter doc to existing chapter
* Use existing typerror exception from Counter
* Match counter filter example task name and output
* python_requirements_info - improvements
- returns python version broken down into its components
- minor refactoring
* adjusted indentation in the documentaiton blocks
* added changelog fragment
* fixes from PR review + assertion in test
* initial commit for deprecate_attrs
* completed tests
* added spaces
* test now works when tehre is more than one deprecation
* trying == instead of eq in jinja
* new approach to testing
* removed extraneous debug message
* Replace RHEL 8.4 by RHEL 8.5 for devel.
* Install virtualenv.
* Revert "Install virtualenv."
This reverts commit 22ba0d074e.
* Just do another skip...
* Add test which allows to query whether an action is available.
* Add documentation.
* Fix FreeBSD / macOS compatibility.
* Rename an_action -> a_module.
* Forgot one place.
* KeycloakClientDiffBugs - Introduce test that passes.
* KeycloakClientDiffBugs - Add test to show that checking of redirect_uri's fails.
* KeycloakClientDiffBugs - (Fix1) Update so that checking of `redirectUris` no longer shows a change.
* KeycloakClientDiffBugs - Add test to show that checking of attributes's fails (sorting issue)
* KeycloakClientDiffBugs - (Fix2) Update so that checking of `attributes` no longer shows a change.
* KeycloakClientDiffBugs - Add test to show that checking of protocol_mappers's fail
* KeycloakClientDiffBugs - (Fix3) Update so that checking of `protocol_mappers` no longer shows a change when there is none.
* Introduce code fragment.
* Update the changelog to be based on the PR instead of the issue.
* Fix the readme
* Fix yaml indentation.
* Fix pep8
* Update changelogs/fragments/3610-fix-keycloak-client-diff-bugs-when-sorting.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update changelogs/fragments/3610-fix-keycloak-client-diff-bugs-when-sorting.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/identity/keycloak/keycloak_client.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Remove need for .copy() after making normalise_cr not mutate the dict.
Co-authored-by: Pierre Dumuid <pierre@knowyourdata.com.au>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Add initialize_with_readme option to gitlab_project. Update integration/unit tests.
* Fix pep8
* Revert unit tests
* Update plugins/modules/source_control/gitlab/gitlab_project.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/source_control/gitlab/gitlab_project.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/source_control/gitlab/gitlab_project.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Move initialize_with_readme to proper spot to only add if project does not exist.
* Update plugins/modules/source_control/gitlab/gitlab_project.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* pipx - fixed bug in state=inject
* added changelog fragment
* copy/paste error in the integration test
* replaced injected package with simpler one
* testing force_lang = None
* disable UTF-8 emojis in pipx output
* better way to achieve the same outcome
* Adjsuted the changelog fragment
* added module mssql_script
* Add changelog fragment
* fixed fragment file (yamllint)
* added me as maintainer
* minor cleanup. (PR comments)
* adjusted for PR comments
- changed key for query results depending on output
- removed "empty" string defaults
* convert unserializable values to string
* python 2 support
* Apply suggestions from code review
Co-authored-by: Felix Fontein <felix@fontein.de>
* updates to docs
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* dnf_versionlock: new module
* dnf_versionlock: fix style in doc
* dnf_versionlock: use check_rc in run_command
* dnf_versionlock: fix style and typos in doc
* pkgng: package reinstallations count as changed
`upgrade_packages()` only looked for the string
"Number of packages to be upgraded", but the
`pkg upgrade` command also reports "Number of packages to be
reinstalled". Reinstallation occurs when package metadata other
than version changes (e.g. build options, single architecture to `*`
architecture). In any other respect, though, a required
reinstallation is the same as an upgrade.
* pkgng: check_mode should count queued actions
Writing tests caught a bug in PR #3393, which enabled
installing more than one package per `pkg` execution.
In converting the module's install/upgrade code to a
queue structure, check_mode got broken because the count
of actions performed was only updated in the `if not check_mode`
block that invokes `pkg`. This two-line change counts
the number of actions in the queue when check mode is
enabled.
* pkgng: add basic integration tests
Test installing a package
Test installing a package into a jail
* pkgng: test with zsh not bash package
Had been using bash package, because it's not
likely to disappear from the package repository
any time soon. Turns out that bash is already
installed on the Ansible community.general
FreeBSD CI VM image, which makes the test fail.
Zsh probably isn't going away any time soon,
either, and likely won't be installed on the
CI image.
* pkgng: remove redundant test for docker container
These tests should be skip/docker, but the test
playbook also redundantly checked whether it was
running in a docker container.
Checking whether `ansible_facts.distribution` is
`FreeBSD` is really sufficient to be sure whether
the test is running in an environment that supports
the `pkgng` module.
* pkgng: add state=absent test
Also renumber `jail=...` test to make diffs less
noisy when adding more non-jailed tests.
* pkgng: add state=latest idemptency test
Add test between state=present and
state=absent that ensures state=latest runs
successfully on an already up-to-date package
with changed=false.
* pkgng: add state=latest test
Including small filesize out-of-date package from
FreeBSD 11 package repository, because FreeBSD 11 is
currently EOL. This test might fail at some point in the
future if the pkg utility in a FreeBSD version > 14
makes breaking changes that prevents it from installing
older package formats.
If that occurs, the fix is to replace
`files/freebsd-release-manifests-20210413__FreeBSD_11.pkg`
with the version of freebsd-release-manifests from the oldest
non-breaking release of FreeBSD, and update the
references to it in tasks/main.yml accordingly.
* pkgng: use hand-generated test package
Instead of relying on a broken-ish installation
of an older package from FreeBSD 11, hand-generate
a package named `zsh` with no contents and a version
number of `0`. It can be installed on any architecture
and any revision of FreeBSD sucessfully, and it will
always be eligible for upgrade.
* pkgng: CI seems to dislike plus-signs in filenames
* pkgng: refactor renaming test package manifests
refactored to make intent of adding '+' sign clearer
* pkgng: refactor upgraded pattern matching
Implement russoz's suggestion to put all
variants in the pattern.
* pkgng: add cached=yes test
Changed idempotency test, because this covers both.
* pkgng: test pkg works on any FreeBSD version
Removing `ansible_distribution_version`, because the
test out-of-date zsh package should install on any
FreeBSD version.
* pkgng: move FreeBSD tasks to imported file
Refactoring tests for more reuse and easier
readability.
* pkgng: refactor tests for task reuse
Several tests need to install an out-of-date package
to test whether upgrades occur successfully, so this
commit refactors out the generation of the test package.
Also, factor out things like the name and path of the
test package so that is more maintainable should the
target test package (currently `zsh`) ever need to
change.
* pkgng: test install multiple packages
Multiple packages should install with a single
invocation of the `pkg` utility.
* pkgng: handle space- and comma-separated lists
The module expects a list of strings in the `name` parameter,
but long-standing documentation showed space- and comma-delimited
lists as a valid way of telling the module to act on multiple
packages. Passing these lists through to the `pkg` command can
have unexpected side-effects of upgrading packages when
`state=present` rather than `state=latest` and could result
in the module reporting the wrong number of packages for each
action performed.
* pkgng: test state=latest for mixed install/upgrade
Test that a list of packages given, one not installed
and one installed but out-of-date are handled correctly.
* pkgng: use YAML lists for multiple packages
I had been following the documentation examples, and
specifiying multiple packages on one line. The right way
to do it is with YAML list syntax.
* pkgng: add test for autoremove=yes
Install package with known dependencies, then
remove it and ask autoremove to run.
* pkgng: test autoremove=yes only on FreeBSD > 12
The CI test runner on FreeBSD 12.0 times out when
downloading large packages.
* pkgng: test jail creation logging less verbose
`ezjail-admin` had been spewing every filename copied
into the jail onto stderr, making the `ansible-test -v`
logs hard to scroll through. Changed it so that ezjail
output only shows up in the ansible task logs if
`ansible_verbosity > 1` (`-vv...`). Full `ezjail-admin`
output is always logged to `/tmp/ezjail.log`.
* pkgng: pass tests when package dependencies change
Tests that install packages with dependencies were failing
when those dependencies were not already installed, because
the count of installed packages was greater than the count
of requested to be installed packages. This change checks
for a count of installed packages that is greater than or
equal to the count of requested to be installed packages.
Example:
- Test installs packages `zsh` and `fish`
- `fish` has a dependency on `pcre2`
- `pkg` reports `Number of packages to be installed: 3`
* pkgng: test annotation for single package
Add/modify/remove annotation for a single package
* pkgng: fix annotation operations
Annotation has been broken at least since the migration to
collections. There are some breaking typos and function argument
omissions in the code with nothing in `git blame` but "Initial commit".
New integration tests uncovered this breakage. Works now.
* pkgng: test multiple annotations
Test multiple annotations specified both in new (YAML list)
syntax and old (comma-delimited) syntax.
Rename some annotation test tags from the single-annotation
tests to make sure that single and multiple annotation tests
don't collide.
* pkgng: test invalid annotate strings
Ensure that some likely to occur, invalid strings
given to the annotate module parameter 1. fail,
2. do not cause an exception, and 3. do not create
any actual annotations on packages.
* pkgng: fix check_mode for annotate
Actions specified in the `annotate` parameter would
always be performed, even if `check_mode=yes`.
This commit fixes `check_mode` for the annotation
functions and adds integration tests to ensure that
check mode is honored in the future.
* pkgng: call module.run_command with list
Instead of calling `run_command` with a formatted
string, call it with a list to maintain safer argument
separation.
Also, introduce a wrapper for `run_command`, `run_pkgng`,
which manages the process environment and some common
command line switches, based upon the module parameters.
Introduced in this commit, also pass annotation values
to `pkg annotate` via stdin, which is safer with long
values than putting them in argv.
* pkgng: update documentation to match annotate type
Missed updating the documentation to match the change
of the annotate parameter from comma-separated string
to list of strings.
* pkgng: fix syntax for Python 2
Seems *args, **kwargs have to be the last
two arguments in Python 2 syntax. CI sanity
tests were failing.
* pkgng: oops, pkgsite should be from closure
I put `pkgsite` as a keyword argument to `run_pkgng()',
which wasn't correct at all and resulted it in capturing
the second positional argument given by any caller.
`pkgsite` should have been `p["pkgsite"]`, coming from the
closure environment of `main()`.
* pkgng: Fix changelog fragment quote formatting
Co-authored-by: Felix Fontein <felix@fontein.de>
* pkgng: add test prepare task
Make sure test environment does not contain the
test package.
* pkgng: make integration test package more flexible
Make integration test package building template-based,
so more flexible if in the future the name of the test package,
currently `zsh`, must change.
* pkgng: convert generator to list for 2.9
Ansible 2.9 can't count items from a generator,
so convert `select` filter output via `list`
before passing to `count`.
* pkgng: Ansible 2.9 has no "false" Jinja2 test
Apparently Ansible 2.9 doesn't have the "false" test
in Jinja2 contexts. Switching to use `rejectattr(...)`
instead of `selectattr(..., "false")`.
* pkgng: test pkgsite parameter
* pkgng: add tests for chroot and rootdir params
Refactor install tasks into an include file so they
can be reused and tested with various parameters.
* pkgng: clean up test package creation
Make pkg json manifest more readable. Create package using
FreeBSD's `pkg create` instead of manually using tar. This
change also simplifies the manifest to a single file for
the integration test role.
* pkgng: fix#3428; install from local file
Fixes a bug in which the module reported failure
when installing from a local (to the target host)
file path.
Fixes#3428
* pkgng: changelog fragment formatting issue
* pkgng: check for all test package extensions
pkg recently changed file extensions, so for the
tests to work on multiple recent versions of FreeBSD,
we must check for `pkg create` output with varying
filename.
* Revert "pkgng: fix#3428; install from local file"
As the module has invoked pkg with the `-g` flag for
at least 7 years, I'm not sure when it was possible
to install packages from files on the target host
filesystem, because pkg rejects file paths when
the `--glob` flag is enabled.
I considered doing a rework of the pkg invocation
to enable good support for installing from local
files, but it looks like more of a job than for this PR.
This reverts commit 5f94eac41f.
* pkgng: Add minor_changes fragment for #3526
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Integration Tests for Options added, includes 'proxycommand'
* New option 'forwardagent' added to integration tests
* Missing double quotes added to 'forwardagent' values to enforce handling as string
* New option 'forwardagent' added
* yamllint error resolved
* 'forwardagent' type changed from str to choices (yes/no)
* Changelog added
* correct typo
Co-authored-by: Felix Fontein <felix@fontein.de>
* version info added to new option
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix(ssh_config): option name to snake_case, type str to bool
* fix(ssh_config): convert bool true/false to str yes/no
* fix(ssh_config): rename option to 'forward_agent' in integration test
* fix(ssh_config): args key 'forwardagent' renamed to 'forward_agent'
* fix(ssh_config): 'else' replaced with 'if' statement to cover case when value is 'None'
* increase version_added to 4.0.0
Co-authored-by: Felix Fontein <felix@fontein.de>
* simplify if statement for True/False to yes/no mapping
Co-authored-by: Felix Fontein <felix@fontein.de>
* update comment to better describe functionality
Co-authored-by: Felix Fontein <felix@fontein.de>
* fix(ssh_config): avoid overwrite of existing option in case of None value
* test(ssh_config): case added to verify no changes on existing option if not given in playbook
Co-authored-by: Felix Fontein <felix@fontein.de>
* If repo option points to .repo file, download for later parsing
* Parse downloaded .repo file content (ini format)
* Validate downloaded file, map values to repodata, workaround to ignore old .repo related code
* Integration Test adjusted to install python package 'requests' first
* Revert "Integration Test adjusted to install python package 'requests' first"
This reverts commit 0d18352c2238d098831ba6d59b66e731fa8f0cd9.
Not allowed to introduce new dependencies at this point, module_utils usage required
* Remove python 'requests' dependency, using 'fetch_url' and 'to_text' from 'ansible.module_utils' instead
* Prefer alias (name) if given instead repo (url)
* If gpgkey was given in .repo file ensure key get automatically imported
* ConfigParser Import made Python2 compatible
* New .repo code moved below existing run-time parameters checks to keep previous logic
* Obsolete workaround removed
* two pylint/pep8 errors fixed
* name added to autorefresh assert
* Missing assert for 'Delete test repo' added
* name added to priority option assert
* name added to check repo is updated by url assert
* name added to check repo is updated by name assert
* name added to check add a repo by releasever assert
* name added to check remove added repo assert
* name added to check add a repo by basearch assert
* name added to check remove added repo #2 assert
* Bugfix to avoid 'KeyError' Exception in if statements
* Refactoring of configparser related code, usage of module_utils, py2 compatibility
* Removal of some leftover from earlier testing
* Integration tests for add/remove repositories by url to .repo file added
* Additional name added to list of test repos that has to be removed
* Test added to verify cleanup of local .repo file after removal via zypper
* Changelog fragment related to PR #3474 added
* yamllint error resolved
* Refactoring to reduce indentation and removal of else statements
* Integration tests added for loading .repo file from local path
* Test .repo file added
* Dependency to setup_remote_tmp_dir added
* New entry added to 'remove repositories added during test'
* Support for .repo file from local path
* Changelog: Ref to https://github.com/ansible-collections/community.general/issues/3466 added
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* pipx - new module
* using python instead of python3
* removed ensure_path as it is unused
* ensuring we are running the same python as Ansible
* changed the last solution to adding a pipx_path parameter to the module, with a sensible default
* added docs for the new parameter
* changed param name to executable, and customized it for Darwin
* use executable if passed, otherwise use python -m pipx
* minor update
* added examples
* Update plugins/modules/packaging/language/pipx.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/language/pipx.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update plugins/modules/packaging/language/pipx.py
Co-authored-by: Felix Fontein <felix@fontein.de>
* tests names 324 -> 3.24.0
* ensure tox is uninstalled by the beginning of the test
* Renamed option+suggestions from PR
* improved idempotency
* fixed sanity
* fixed test
Co-authored-by: Felix Fontein <felix@fontein.de>