Chef: How to set EDITOR for knife

slayedbylucifer picture slayedbylucifer · Jul 10, 2013 · Viewed 28.3k times · Source

When I run below command I get the error mentioned below:

$ knife node edit hostname.domain.com
ERROR: You must set your EDITOR environment variable or configure your editor via knife.rb

I wanted to set editor value in the knife.rb but I am not able to find which option would correspond to the editor. I have gone through below links which explain various options supported by knife.rb:

http://docs.opscode.com/config_rb_knife.html

http://docs.opscode.com/config_rb_knife_optional_settings.html

I know I did not overlook above links but i can;'t find an option which is relevant to setting editor value.

Could you point me to the correct options whihc will help me set editor for knife.

Thanks.

Answer

Rajesh Hegde picture Rajesh Hegde · Jul 12, 2013

You can set the EDITOR variable in two ways. First way is to SET EDITOR variable in command line.

export "EDITOR=nano"

OR

export "EDITOR=vim"

Second Way is set EDITOR in knife.rb file.

knife[:editor]="vim"

OR

knife[:editor]="nano"

nano is also a editor shipped with Ubuntu.