chef / effortless

Automated best practices for Chef Infra and Chef InSpec
https://chef.io
Apache License 2.0
33 stars 38 forks source link

rubygems_url Broken on Windows #281

Open BrysonR opened 3 years ago

BrysonR commented 3 years ago

Description

chef/scaffolding-chef-infra, on Windows only, sets the value of rubygems_url to a non-existent variable.

The linux scaffolding properly sets it here

The windows scaffolding sets it here which I believe should be the same as the linux version and rubygems_url "${cfg_rubygems_url}"

The outcome is that the rubygems url is never set or defaulted and produces the following output.

Scaffolding Version

chef/scaffolding-chef-infra v0.23.0

Platform Version

Windows Server 2012R2

Build or Run Output

FATAL: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '4'
---- Begin output of ["bundle", "install"] ----
STDOUT: 
STDERR: [!] There was an error parsing `Gemfile`: The source must be an absolute URI. For example:
source 'https://rubygems.org'. Bundler cannot continue.
---- End output of ["bundle", "install"] ----
Ran ["bundle", "install"] returned 4
mrysanek commented 1 year ago

This just bit me, in chef/scaffolding-chef-infra/0.25.0/20220518131557 We set a custom gems URL (onprem artifactory). Worked around it by hacking the output file (client-config.rb) during studio install phase.

function Invoke-Install {
  Invoke-DefaultInstall
  # fix bug in chef/scaffolding-chef-infra
  (Get-Content ${pkg_prefix}/config/client-config.rb) | Foreach-Object {$_ -replace 'rubygems_url "#{rubygems_url}"','rubygems_url "#{cfg_rubygems_url}"'}  | Out-File ${pkg_prefix}/config/client-config.rb
}