Closed ZillaG closed 7 years ago
Out of curiosity I checked chef core to see where the bootstrap directory lives on linux bootstraps. Its also hardcoded to /opt/chef
. That doesn't make this "right". I can definitely see value here.
One workaround is to write a custom bootstrap template to substitute the bootstrap_directory. Here is an example of the changes to the standard windows bootstrap template to accept a "bootstrap_directory" attribute in the -j
<% if @config[:first_boot_attributes]['bootstrap_directory'] -%>
<% bootstrap_directory = @config[:first_boot_attributes]['bootstrap_directory'] -%>
<% else -%>
<% bootstrap_directory = "C:/chef" -%>
<% end -%>
. . .
<% #customize client.rb file to sub out the old bootstrap directory -%>
<%
client_rb = config_content
client_rb.gsub!(/c:\/chef\//i, bootstrap_directory + "/")
puts client_rb
-%>
> <%= bootstrap_directory %>\client.rb (
<%= client_rb %>
)
. . .
<% # customize start_chef to sub out the old bootstrap directory -%>
<%
new_start_chef = start_chef
new_start_chef.gsub!(/c:\/chef\//i, bootstrap_directory + "/")
-%>
<%= new_start_chef %>
The other files hardcoding windows path to C:\ are
f:\opscode\chefdk\embedded\lib\ruby\site_ruby\devkit.rb
f:\opscode\chefdk\embedded\lib\ruby\site_ruby\2.1.0\rubygems\defaults\operating_system.rb
f:\opscode\chefdk\embedded\lib\ruby\gems\2.1.0\gems\knife-windows-1.4.1\lib\chef\knife\core\windows_bootstrap_context.rb
Another possible workaround is symlink junction.exe c:\opscode f:\opscode
There have been a number of issues identified over time with changing the installation path and drive, see https://github.com/chef/chef/issues/1512 for more information.
Closing this one out as the core issue is the linked https://github.com/chef/chef/issues/1512 and not a knife-windows specific issue.
I want to be able to install Chef on my Windows nodes to a different disk, say E:\, but the function
hard-codes it to C:\Chef. It'd be cool if we can do this, in our knife.rb file
knife[:bootstrap_directory] = "E:\\Chef"
for example (but of course qualify it with OS type)