GithubHelp home page GithubHelp logo

Comments (3)

brandonfriess-stripe avatar brandonfriess-stripe commented on June 7, 2024

Possibly related to changes in #13669 ?

I'm puzzled how false is being surfaced here when I clearly have the right types for the resource.

from chef.

jazaval avatar jazaval commented on June 7, 2024

@brandonfriess-stripe are you still seeing this on newer client versions like 18.3.x, 18.4.x? I ran into a similar TypeError which I believe is caused by the Chef::Mixin::HomebrewUser.find_homebrew_username. I can see why running under the launchctl/root context might also make a repro occur here.

#14369

from chef.

brandonfriess-stripe avatar brandonfriess-stripe commented on June 7, 2024

@jazaval I ended up working around it by adding the brew binary path, user, and home dir to the env.

For whatever reason, Chef doesn't expose a property to set the homebrew user or binary path. However...

Deep in the homebrew_update resource they are calling the execute resource and I'm hi-jacking that process to set the ENV to the right things so that this resource will fire correctly under launchd.

Ex:

action :manage do
  if node['cpe_homebrew']['auto-update']
    # Set PATH for Homebrew auto-update so it works in launchd
    ENV['PATH'] = if node.arm64?
                    "/opt/homebrew/bin:/opt/homebrew/sbin:#{ENV['PATH']}"
                  else
                    "/usr/local/bin:/usr/local/sbin:#{ENV['PATH']}"
                  end
    ENV['HOME'] = ::Dir.home(node['cpe_homebrew']['user'])
    ENV['USER'] = node['cpe_homebrew']['user']
    homebrew_update 'macOS' do
      frequency 86_400
      action :periodic
      ignore_failure true
      retries 1
    end
  end
end

For your case, I wonder if you set the owner property to the primary user, it would probably work for you.

from chef.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.