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

homebrew_tap resource always fails with TypeError on x86 #14369

Open
jazaval opened this issue May 7, 2024 · 3 comments
Open

homebrew_tap resource always fails with TypeError on x86 #14369

jazaval opened this issue May 7, 2024 · 3 comments
Assignees
Labels
Status: Untriaged An issue that has yet to be triaged.

Comments

@jazaval
Copy link
Contributor

jazaval commented May 7, 2024

Description

When using the homebrew_tap resource in a recipe run on a x86 instance of macOS, the resource fails to compile with a TypeError

Chef Version

18.4.2, 18.4.12

Platform Version

x86 macOS 14.4.1

Replication Case

Run a recipe containing any call of homebrew_tap in Kitchen CI or on a physical x86 Mac.

Client Output


           Compiled Resource:
           ------------------
           # Declared in /Users/Shared/kitchen/cache/cookbooks/foo/recipes/git_prep.rb:16:in `from_file'
           
           homebrew_tap("microsoft/git") do
             action [:tap]
             default_guard_interpreter :default
             declared_type :homebrew_tap
             cookbook_name "aces"
             recipe_name "git_prep"
             homebrew_path "/usr/local/bin/brew"
             tap_name "microsoft/git"
           end
           
           System Info:
           ------------
           chef_version=18.4.12
           platform=mac_os_x
           platform_version=14.4.1
           ruby=ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin19]
           program_name=/opt/chef/bin/chef-client
           executable=/opt/chef/bin/chef-client

       
       Running handlers:
       [2024-05-07T12:56:31-07:00] ERROR: Running exception handlers
       Running handlers complete
       [2024-05-07T12:56:31-07:00] ERROR: Exception handlers complete
       Infra Phase failed. 45 resources updated in 05 minutes 50 seconds

Stacktrace

Generated at 2024-05-07 13:12:39 -0700
TypeError: homebrew_tap[microsoft/git] (foo::git_prep line 16) had an error: TypeError: no implicit conversion of false into String
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource/homebrew_tap.rb:77:in `dirname'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource/homebrew_tap.rb:77:in `tapped?'
/opt/chef/embedded/lib/ruby/3.1.0/forwardable.rb:238:in `tapped?'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource/homebrew_tap.rb:52:in `block in <class:HomebrewTap>'
(eval):2:in `block in action_tap'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/provider.rb:304:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/provider.rb:304:in `compile_and_converge_action'
(eval):2:in `action_tap'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/provider.rb:245:in `run_action'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource.rb:601:in `block in run_action'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource.rb:628:in `with_umask'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource.rb:600:in `run_action'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/runner.rb:74:in `run_action'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/runner.rb:108:in `block in run_all_actions'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/runner.rb:108:in `each'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/runner.rb:108:in `run_all_actions'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/runner.rb:132:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource_collection/resource_list.rb:96:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource_collection/stepable_iterator.rb:54:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/resource_collection/resource_list.rb:94:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/3.1.0/forwardable.rb:238:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/runner.rb:130:in `converge'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/client.rb:869:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/client.rb:864:in `catch'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/client.rb:864:in `converge'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/client.rb:888:in `converge_and_save'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/client.rb:298:in `run'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/application.rb:305:in `run_with_graceful_exit_option'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/application.rb:281:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/local_mode.rb:42:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/application.rb:264:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/application/base.rb:354:in `run_application'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-18.4.2/lib/chef/application.rb:67:in `run'
/opt/chef/embedded/lib/ruby/gems/3.1.0/gems/chef-bin-18.4.2/bin/chef-client:25:in `<top (required)>'
/opt/chef/bin/chef-client:183:in `load'
/opt/chef/bin/chef-client:183:in `<main>'
@jazaval jazaval added the Status: Untriaged An issue that has yet to be triaged. label May 7, 2024
@tpowell-progress
Copy link
Contributor

@Stromweld Feels like we fixed this? Maybe it was after 18.4.2?

@tpowell-progress tpowell-progress self-assigned this May 21, 2024
@jazaval
Copy link
Contributor Author

jazaval commented May 21, 2024

#13721 fixed this resource for :untap on Apple Silicon / arm64 after the addition of arm brew support via #13669.

18.3.0 fails on x86 macOS 14 as well, but with a compile-time error that comes from calling Chef::Mixin::HomebrewUser.find_homebrew_username in a cookbook library of ours that is responsible for setting up homebrew in the first place:

       Relevant File Content:
       ----------------------
       /Users/Shared/kitchen/cache/cookbooks/foo/libraries/homebrew.rb:
       
        16:  
        17:        def owner
        18:          begin
        19>>           Chef::Mixin::HomebrewUser.find_homebrew_username
        20:          rescue Chef::Exceptions::CannotDetermineHomebrewOwner
        21:            shell_out(ExecPath.stat, '-f', '%Su', '/dev/console').stdout.chomp
        22:          end
        23:        end
        24:  

       
       System Info:
       ------------
       chef_version=18.3.0
       platform=mac_os_x
       platform_version=14.4.1
       ruby=ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin19]
       program_name=/opt/chef/bin/chef-client
       executable=/opt/chef/bin/chef-client

@jazaval
Copy link
Contributor Author

jazaval commented May 21, 2024

Possible you're remembering #13937?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants