chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

Hostname containing windows. Please install knife-window #322

Closed sully255 closed 8 years ago

sully255 commented 8 years ago

I am not able to bootstrap a windows machine. I am getting the following error: -Hostname containing windows. Please install knife-window.

I have knife-windows gem installed. I know this because I manually installed the gem and all the perquisites but when I try to boot strap a windows machine I get the error.

Any help wold be greatly appreciated

ssafron commented 8 years ago

I recently encountered this as well. When you run "knife --help" you will see that there are no "knife bootstrap windows" subcommands listed. Just "knife bootstrap".

I found that I had both "chef" and "chefdk" installed on my machine. The knife-windows gem was installed in the /opt/chefdk/embedded directory but not in /opt/chef/embedded. The /usr/bin/knife command in my $PATH was a symbolic link to /opt/chef/bin/knife, so it looked for the gem in /opt/chef/embedded and didn't find it. My fix was to change the /usr/bin/chefdk symlink to /opt/chefdk/bin/knife instead of /opt/chef/bin/knife, and it picked up the knife-windows gem correctly.

So check where you have the knife-windows gem installed. For instance try running these commands to see where it is installed: /opt/chef/embedded/bin/gem list knife-windows /opt/chefdk/embedded/bin/gem list knife-windows /opt/opscode/embedded/bin/gem list knife-windows

Then make sure you are running the knife command that is in the same path.

sully255 commented 8 years ago

That makes perfect sense but I am running the Chef Client on a Windows 2008 Server. What would the windows commands be?

mwrock commented 8 years ago

On windows you can run chef shell-init powershell | Invoke-Expression to propperly setup your PATH

sully255 commented 8 years ago

That seemed to work but only in the active session. How can I make that permanent meaning once I reboot I have to run that command again.

mwrock commented 8 years ago

I add it to my profile so its always there. Your profile is located at the path in the $PROFILE automatic variable.

mwrock commented 8 years ago

Also, if using chefdk, if you open powershell using the chefdk desktop icon, that will have that pre set.

sully255 commented 8 years ago

That worked.

Thank you