From 1aa26662ef08e8ecbfa515c758b704c8749a0bc0 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 26 Jan 2021 07:55:56 +0100 Subject: [PATCH] Add default `brew` search path for non-Intel / Apple silicon hardware (#1679) (#1680) * Add default brew search path for non-Intel / Apple silicon hardware * add changelog fragment * Update 1679-homebrew_search_path.yml fix for double-ticks in yaml/rst format * missing dots and brackets (cherry picked from commit 2a53edd9bcf1b6d3f69c8644ff5df5030d3e165d) Co-authored-by: Anatoly Pugachev --- changelogs/fragments/1679-homebrew_search_path.yml | 8 ++++++++ plugins/modules/packaging/os/homebrew.py | 6 +++--- plugins/modules/packaging/os/homebrew_cask.py | 4 ++-- plugins/modules/packaging/os/homebrew_tap.py | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/1679-homebrew_search_path.yml diff --git a/changelogs/fragments/1679-homebrew_search_path.yml b/changelogs/fragments/1679-homebrew_search_path.yml new file mode 100644 index 0000000000..fa2d995891 --- /dev/null +++ b/changelogs/fragments/1679-homebrew_search_path.yml @@ -0,0 +1,8 @@ +--- +bugfixes: + - homebrew - add default search path for ``brew`` on Apple silicon hardware + (https://github.com/ansible-collections/community.general/pull/1679). + - homebrew_cask - add default search path for ``brew`` on Apple silicon hardware + (https://github.com/ansible-collections/community.general/pull/1679). + - homebrew_tap - add default search path for ``brew`` on Apple silicon hardware + (https://github.com/ansible-collections/community.general/pull/1679). diff --git a/plugins/modules/packaging/os/homebrew.py b/plugins/modules/packaging/os/homebrew.py index d13a27d60d..21dea647f5 100644 --- a/plugins/modules/packaging/os/homebrew.py +++ b/plugins/modules/packaging/os/homebrew.py @@ -38,7 +38,7 @@ options: - "A ':' separated list of paths to search for 'brew' executable. Since a package (I(formula) in homebrew parlance) location is prefixed relative to the actual path of I(brew) command, providing an alternative I(brew) path enables managing different set of packages in an alternative location in the system." - default: '/usr/local/bin' + default: '/usr/local/bin:/opt/homebrew/bin' type: path state: description: @@ -76,7 +76,7 @@ notes: ''' EXAMPLES = ''' -# Install formula foo with 'brew' in default path (C(/usr/local/bin)) +# Install formula foo with 'brew' in default path - community.general.homebrew: name: foo state: present @@ -871,7 +871,7 @@ def main(): elements='str', ), path=dict( - default="/usr/local/bin", + default="/usr/local/bin:/opt/homebrew/bin", required=False, type='path', ), diff --git a/plugins/modules/packaging/os/homebrew_cask.py b/plugins/modules/packaging/os/homebrew_cask.py index 2286d35564..feb1ba68fe 100644 --- a/plugins/modules/packaging/os/homebrew_cask.py +++ b/plugins/modules/packaging/os/homebrew_cask.py @@ -32,7 +32,7 @@ options: path: description: - "':' separated list of paths to search for 'brew' executable." - default: '/usr/local/bin' + default: '/usr/local/bin:/opt/homebrew/bin' type: path state: description: @@ -779,7 +779,7 @@ def main(): elements='str', ), path=dict( - default="/usr/local/bin", + default="/usr/local/bin:/opt/homebrew/bin", required=False, type='path', ), diff --git a/plugins/modules/packaging/os/homebrew_tap.py b/plugins/modules/packaging/os/homebrew_tap.py index 3fbf6b3394..d31da48523 100644 --- a/plugins/modules/packaging/os/homebrew_tap.py +++ b/plugins/modules/packaging/os/homebrew_tap.py @@ -218,7 +218,7 @@ def main(): brew_path = module.get_bin_path( 'brew', required=True, - opt_dirs=['/usr/local/bin'] + opt_dirs=['/usr/local/bin', '/opt/homebrew/bin'] ) taps = module.params['name']