pivotal-sprout / sprout-jetbrains-editors

Recipes for installing Pivotal's IDE prefs
MIT License
0 stars 4 forks source link

IntelliJ IDEA CE fails to install because of missing cask #8

Closed sidho closed 8 years ago

sidho commented 8 years ago

Hi Luke,

The recipe sprout-jetbrains-editors::intellij_ce fails because Homebrew is unable to find the cask when running brew cask install intellij-idea-ce. Going through caskroom/versions instead and using brew cask install caskroom/versions/intellij-idea-ce instead seems to work.

Here is the logs if you need them:

Recipe: sprout-jetbrains-editors::intellij_ce
  * homebrew_cask[intellij-idea-ce] action install[2016-02-02T12:25:53-08:00] INFO: Processing homebrew_cask[intellij-idea-ce] action install (sprout-jetbrains-editors::intellij_ce line 1)

    * execute[installing cask intellij-idea-ce] action run[2016-02-02T12:25:53-08:00] INFO: Processing execute[installing cask intellij-idea-ce] action run (/Users/pivotal/workspace/sprout-wrap/cookbooks/homebrew/providers/cask.rb line 29)

      [execute] Error: No available Cask for intellij-idea-ce
                Error: nothing to install

      ================================================================================
      Error executing action `run` on resource 'execute[installing cask intellij-idea-ce]'
      ================================================================================

      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '1'
      ---- Begin output of /usr/local/bin/brew cask install intellij-idea-ce  ----
      STDOUT:
      STDERR: Error: No available Cask for intellij-idea-ce
      Error: nothing to install
      ---- End output of /usr/local/bin/brew cask install intellij-idea-ce  ----
      Ran /usr/local/bin/brew cask install intellij-idea-ce  returned 1

      Resource Declaration:
      ---------------------
      # In /Users/pivotal/workspace/sprout-wrap/cookbooks/homebrew/providers/cask.rb

       29:   execute "installing cask #{new_resource.name}" do
       30:     command "/usr/local/bin/brew cask install #{new_resource.name} #{new_resource.options}"
       31:     user homebrew_owner
       32:     environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
       33:     not_if { new_resource.casked? }
       34:   end
       35: end

      Compiled Resource:
      ------------------
      # Declared in /Users/pivotal/workspace/sprout-wrap/cookbooks/homebrew/providers/cask.rb:29:in `block in class_from_file'

      execute("installing cask intellij-idea-ce") do
        action [:run]
        retries 0
        retry_delay 2
        default_guard_interpreter :execute
        command "/usr/local/bin/brew cask install intellij-idea-ce "
        backup 5
        environment #<Chef::DelayedEvaluator:0x007ffc696b6648@/Users/pivotal/workspace/sprout-wrap/cookbooks/homebrew/providers/cask.rb:32>
        returns 0
        user "pivotal"
        declared_type :execute
        cookbook_name :"sprout-jetbrains-editors"
        homebrew_owner "pivotal"
        not_if { #code block }
      end

[2016-02-02T12:25:54-08:00] INFO: Running queued delayed notifications before re-raising exception

    ================================================================================
    Error executing action `install` on resource 'homebrew_cask[intellij-idea-ce]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    execute[installing cask intellij-idea-ce] (/Users/pivotal/workspace/sprout-wrap/cookbooks/homebrew/providers/cask.rb line 29) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
    ---- Begin output of /usr/local/bin/brew cask install intellij-idea-ce  ----
    STDOUT:
    STDERR: Error: No available Cask for intellij-idea-ce
    Error: nothing to install
    ---- End output of /usr/local/bin/brew cask install intellij-idea-ce  ----
    Ran /usr/local/bin/brew cask install intellij-idea-ce  returned 1

    Resource Declaration:
    ---------------------
    # In /Users/pivotal/workspace/sprout-wrap/cookbooks/sprout-jetbrains-editors/recipes/intellij_ce.rb

      1: homebrew_cask 'intellij-idea-ce'
      2: sprout_jetbrains_editors_pivotal_preferences 'intellijcommunity'

    Compiled Resource:
    ------------------
    # Declared in /Users/pivotal/workspace/sprout-wrap/cookbooks/sprout-jetbrains-editors/recipes/intellij_ce.rb:1:in `from_file'

    homebrew_cask("intellij-idea-ce") do
      action [:install]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :homebrew_cask
      cookbook_name :"sprout-jetbrains-editors"
      recipe_name "intellij_ce"
    end

[2016-02-02T12:25:54-08:00] INFO: Running queued delayed notifications before re-raising exception
[2016-02-02T12:25:54-08:00] INFO: execute[TimeMachine should NOT appear in the status bar] sending run action to execute[restart SystemUIServer] (delayed)
Recipe: sprout-osx-settings::timemachine
  * execute[restart SystemUIServer] action run[2016-02-02T12:25:54-08:00] INFO: Processing execute[restart SystemUIServer] action run (sprout-osx-settings::timemachine line 17)
[2016-02-02T12:25:54-08:00] INFO: execute[restart SystemUIServer] ran successfully

    - execute killall -HUP SystemUIServer

Running handlers:
[2016-02-02T12:25:54-08:00] ERROR: Running exception handlers
Running handlers complete
[2016-02-02T12:25:54-08:00] ERROR: Exception handlers complete
Chef Client failed. 74 resources updated in 01 minutes 31 seconds
[2016-02-02T12:25:54-08:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-02-02T12:25:54-08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-02-02T12:25:54-08:00] ERROR: homebrew_cask[intellij-idea-ce] (sprout-jetbrains-editors::intellij_ce line 1) had an error: Mixlib::ShellOut::ShellCommandFailed: execute[installing cask intellij-idea-ce] (/Users/pivotal/workspace/sprout-wrap/cookbooks/homebrew/providers/cask.rb line 29) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/local/bin/brew cask install intellij-idea-ce  ----
STDOUT:
STDERR: Error: No available Cask for intellij-idea-ce
Error: nothing to install
---- End output of /usr/local/bin/brew cask install intellij-idea-ce  ----
Ran /usr/local/bin/brew cask install intellij-idea-ce  returned 1
[2016-02-02T12:25:54-08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Thanks,

Sid

LukeWinikates commented 8 years ago

So the pull request I just opened has a change that likely fixes this, but I'm having some trouble running the recipe locally on my machine. Wondering if @wendorf has any thoughts. The stacktrace suggests that the problem is in the chef homebrew code itself.

If I run:

% soloist run_recipe sprout-jetbrains-editors::intellij_ce

I see a NoMethodError from the chef code for homebrew:

NoMethodError
    -------------
    execute[installing cask caskroom/versions/intellij-idea-ce] (/Users/rukednous/workspace/sprout-jetbrains-editors/cookbooks/homebrew/providers/cask.rb line 31) had an error: NoMethodError: undefined method `shell_out' for Chef::Resource::HomebrewCask

    Cookbook Trace:
    ---------------
    /Users/rukednous/workspace/sprout-jetbrains-editors/cookbooks/homebrew/resources/cask.rb:13:in `casked?'
    /Users/rukednous/workspace/sprout-jetbrains-editors/cookbooks/homebrew/providers/cask.rb:34:in `block (3 levels) in class_from_file'

    Resource Declaration:
    ---------------------
    # In /Users/rukednous/workspace/sprout-jetbrains-editors/cookbooks/sprout-jetbrains-editors/recipes/intellij_ce.rb

      1: homebrew_cask 'caskroom/versions/intellij-idea-ce'
      2: sprout_jetbrains_editors_pivotal_preferences 'intellijcommunity'
wendorf commented 8 years ago

@LukeWinikates,

That looks like a strange error (and different than the one I encounter when I try to run it). shell_out should be available, and I can confirm that by trying to homebrew_cask 'intellij-idea-ce', which succeeds for me. It could be that your bundle is out of date. Can you give that a shot?

LukeWinikates commented 8 years ago

Indeed, bundle update got rid of that error. I updated the pull request based on @wendorf 's comments. I see some value in having an integration test, or perhaps something in the test suite that verifies that anything we try to install from homebrew still exists. That might be a chore for another day when I have an OSX vm handy.

I do still get an error from homebrew myself, even with caskroom/verisons tapped:

% brew update
% brew cask install intellij-idea-ce
Error: Cask 'intellij-idea-ce' definition is invalid: Bad header line: parse failed
wendorf commented 8 years ago

I believe that particular error occurs if you still have the "old" homebrew-cask from before it was bundled with normal homebrew. The recommended fix from homebrew-cask:

Important December update: Homebrew-Cask will now be kept up to date together with Homebrew (see #15381 for details). If you haven’t yet, run brew uninstall --force brew-cask; brew update to switch to the new system.

To note: If you are running a sprout-wrap that still uses the (soon-to-be) deprecated sprout-homebrew::* recipes, you may find yourself repeatedly in the position of needing to uninstall brew-cask. Migrating to Chef's homebrew cookbook as outlined in this commit is recommended.

LukeWinikates commented 8 years ago

I see -- sounds like that's an issue specific to the machine I'm testing on. brew uninstall --force brew-cask; brew update makes that go away. That suggests that the updated pull request should work end-to-end. I can try that on a clean vm later, or if somebody else wants to give it a spin and verify that it's safe to merge, then we could close this issue out for @sidho and others.

wendorf commented 8 years ago

Looks good to me. Thanks!