chef / knife-windows

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

FATAL : Cannot find subcommand for : 'windows' #376

Closed anshulshrivastava closed 8 years ago

anshulshrivastava commented 8 years ago

I'have installed knife-windows using gem. gem install knife-windows

I can generate certs, .pfx files using knife windows cert command on my local machine, but while I ran the following command, I am getting this fatal error on EC2 Windows instance (Windows Server 2012) -

knife windows cert install "~/server_cert.pfx" --cert-passphrase "strong_passphrase"

How do I make it working, my other knife commands is working perfectly.

mwrock commented 8 years ago

That is very odd. So the environment succesfully finds subcommand knife windows cert generate but not knife windows cert install. Do you have multiple versions of knife-windows installed?

anshulshrivastava commented 8 years ago

Let me clear few things,

I installed knife-windows gem by gem install knife-windows on remote windows machine

But, I am not able to run knife windows COMMAND on my windows EC2 instance, I installed knife-windows gem. I tried this as well chef gem install knife-windows. But no luck.

Any Ideas what I am missing here, all my chef files inside C:\chef folder (client.rb, first-boot.json, validation.pem, encrypted_data_bag_secret).

And my ruby files are C:\Ruby23 folder. I am kind of a new for using chef on windows machines.

mwrock commented 8 years ago

Ok that does make more sense. This could be a result of multiple rubies. You have c:\Ruby23 and the embedded ruby inside of chef. Depending on your path, I'd bet that gem install is running against c:\Ruby23 which is an entirely different ruby environment from inside chef. I know this can be confusing. I would simply not have c:\Ruby23 on the machine if thats not a requirement. If you run c:\opscode\embedded\bin\gem.bat install that will guarantee you run the gem install against the chef ruby.

btm commented 8 years ago

I agree with @mwrock that this is probably from having multiple ruby installations, your install in C:\Ruby23 and the install that ships with Chef or ChefDK. You should install ChefDK on your workstation as it includes knife-windows. If you wanted to install a knife plugin to ChefDK you would run chef gem install PLUGIN_NAME.

If you need further help, please post a message in the 'chef' category on Discourse instead of filing an issue: https://discourse.chef.io/.