mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-03 15:04:02 -07:00
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.16) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled
homebrew: Support old_tokens and oldnames in homebrew package data (#10805)
* homebrew: Support old_tokens and oldnames in homebrew package data
Fixes #10804
Since brew info will accept old_tokens (for casks) and oldnames (for formulae) when provided by the homebrew module "name" argument, the module also needs to consider thes old names as valid for the given package. This commit updates _extract_package_name to do that.
All existing package name tests, including existing tests for name aliases and tap prefixing, have been consolidated with new name tests into package_names.yml.
* Added changelog fragment.
* homebrew: replace non-py2 compliant f-string usage
* code formatting lint, and py2 compatibility fixes
* homebrew: added licenses to new files, nox lint
* Update plugins/modules/homebrew.py
use str.format() instead of string addition
* Update tests/integration/targets/homebrew/tasks/casks.yml
* Update tests/integration/targets/homebrew/tasks/package_names_item.yml
* Update tests/integration/targets/homebrew/tasks/formulae.yml
* Fixes for performance concerns on new homebrew tests.
1) tests for alternate package names are commented out in main.yml.
2) the "install via alternate name, uninstall via base name" test
case was deemed duplicative, and has been deleted .
3) minor fixes to use jinja2 "~" for string concat instead of "+"
* Fix nox lint
---------
(cherry picked from commit 833e6e36de
)
Co-authored-by: brad2014 <brad2014@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
97 lines
2.6 KiB
YAML
97 lines
2.6 KiB
YAML
---
|
|
####################################################################
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
####################################################################
|
|
|
|
# Test code for the homebrew module.
|
|
# Copyright (c) 2020, Abhijeet Kasurde <akasurde@redhat.com>
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
- name: Find brew binary
|
|
command: which brew
|
|
register: brew_which
|
|
|
|
- name: Get owner of brew binary
|
|
stat:
|
|
path: "{{ brew_which.stdout }}"
|
|
register: brew_stat
|
|
|
|
# - name: Use ignored-pinned option while upgrading all
|
|
# homebrew:
|
|
# upgrade_all: true
|
|
# upgrade_options: ignore-pinned
|
|
# become: true
|
|
# become_user: "{{ brew_stat.stat.pw_name }}"
|
|
# register: upgrade_option_result
|
|
# environment:
|
|
# HOMEBREW_NO_AUTO_UPDATE: True
|
|
|
|
# - assert:
|
|
# that:
|
|
# - upgrade_option_result.changed
|
|
|
|
- vars:
|
|
package_name: kitty
|
|
|
|
block:
|
|
- name: Make sure {{ package_name }} package is not installed
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: absent
|
|
update_homebrew: false
|
|
become: true
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
|
|
- name: Install {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: present
|
|
update_homebrew: false
|
|
become: true
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- package_result is changed
|
|
|
|
- name: Again install {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: present
|
|
update_homebrew: false
|
|
become: true
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- package_result is not changed
|
|
|
|
- name: Uninstall {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: absent
|
|
update_homebrew: false
|
|
become: true
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- package_result is changed
|
|
|
|
- name: Again uninstall {{ package_name }} package using homebrew
|
|
homebrew:
|
|
name: "{{ package_name }}"
|
|
state: absent
|
|
update_homebrew: false
|
|
become: true
|
|
become_user: "{{ brew_stat.stat.pw_name }}"
|
|
register: package_result
|
|
|
|
- assert:
|
|
that:
|
|
- package_result is not changed
|