Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix homebrew tap name handling #9546

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- homebrew - fix incorrect handling of homebrew modules when a tap is requested (https://github.com/ansible-collections/community.general/pull/9546, https://github.com/ansible-collections/community.general/issues/9533).
2 changes: 1 addition & 1 deletion plugins/modules/homebrew.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def _save_package_info(self, package_detail, package_name):
self.outdated_packages.add(package_name)

def _extract_package_name(self, package_detail, is_cask):
canonical_name = package_detail["token"] if is_cask else package_detail["name"] # For ex: 'sqlite'
canonical_name = package_detail["full_token"] if is_cask else package_detail["full_name"] # For ex: 'sqlite'
all_valid_names = set(package_detail.get("aliases", [])) # For ex: {'sqlite3'}
all_valid_names.add(canonical_name)

Expand Down
24 changes: 24 additions & 0 deletions tests/integration/targets/homebrew/tasks/formulae.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,27 @@
- "reinstall_result.msg == 'Package already installed: sqlite3'"
- "reinstall_result.changed_pkgs == []"
- "reinstall_result.unchanged_pkgs == ['sqlite3']"

# Test with homebrew tap
- block:
- name: Tap terraform homebrew repository
community.general.homebrew_tap:
name: hashicorp/tap
become: true
become_user: "{{ brew_stat.stat.pw_name }}"

- name: Install homebrew tap
community.general.homebrew:
name: hashicorp/tap/terraform
state: latest
update_homebrew: false
register: terraform_install_result
become: true
become_user: "{{ brew_stat.stat.pw_name }}"

- assert:
that:
- terraform_install_result is changed
- "terraform_install_result.msg == 'Package upgraded: hashicorp/tap/terraform'"
- "terraform_install_result.changed_pkgs == ['hashicorp/tap/terraform']"
- "terraform_install_result.unchanged_pkgs == []"
Loading