Zuehlke / cookbook-windev

One cookbook with resources for setting up a Windows development environment
MIT License
7 stars 1 forks source link

Chef crashes with newer version of chocolatey #51

Open Pelotrio opened 1 year ago

Pelotrio commented 1 year ago

Problem

When using this library it will automatically install the newest version of chocolatey using the library it depends on. All version newer than 1.4.0 dont seem to be compatible with the script that installs chocolatey packages. When trying to install packages I get following error:

    Chef::Exceptions::Package
    -------------------------
    No candidate version available for git

    Resource Declaration:
    ---------------------
    # In c:/users/pc/documents/mas-automation/tools/provision/scripts/local-mode-cache/cache/cookbooks/windev/recipes/choco_packages.rb

     30:     chocolatey_package pkg["name"] do
     31:       version pkg_version unless pkg_version.empty?
     32:       source pkg_source unless pkg_source.empty?
     33:       options pkg_options unless pkg_options.empty?
     34:       returns [0,3010] + pkg.fetch('exit_codes', [])
     35:       action package_action
     36:     end
     37:   end

    Compiled Resource:
    ------------------
    # Declared in c:/users/pc/documents/mas-automation/tools/provision/scripts/local-mode-cache/cache/cookbooks/windev/recipes/choco_packages.rb:30:in `block in from_file'

    chocolatey_package("git") do
      package_name ["git"]
      action [:upgrade]
      default_guard_interpreter :default
      declared_type :chocolatey_package
      cookbook_name "windev"
      recipe_name "choco_packages"
      options "--install-arguments='/verysilent /DIR=C:\\tools\\git /pathoption=BashOnly /components=ext,ext\\shellhere,gitlfs,consolefont /CRLFOption=CRLFAlways /SSHOption=OpenSSL  /CURLOption=OpenSSL'"
      returns [0, 3010]
    end

Possible solutions

Either the script that installs packages has to be updated to support newer versions or the version of choco that gets installed has to be locked to version 1.4.0. The annoying thing about this is that this is only fixable when manually downgrading to this version and then re-running chef which is not optimal.