Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following as my knife.rb:

log_level                :info
log_location             STDOUT
node_name                'user'
client_key               '/home/user/.chef/user.pem'
validation_client_name   'chef-validator'
validation_key           '~/.chef/validation.pem'
chef_server_url          'url:4000'
cache_type               'BasicFile'
cache_options( :path => '/home/user/.chef/checksums' )
cookbook_path [ './', './site-cookbooks' ]

I can do "knife cookbook list" and all that fun stuff just fine, but when I go to edit I get:

# knife node edit -c knife.rb -e vim
ERROR: ArgumentError: Attribute chef_environment is not defined!

I have an environment set up:

# knife environment list

and the node I'm trying to edit is on that environment. I have tried using the -E param, as well as adding an "environment" and "chef_environment" parameter to my knife.rb (the docs are a bit ambiguous as to which I should use), but to no avail. Anyone have any advice on this?

share|improve this question
up vote 1 down vote accepted

What version of Chef do you have installed on the local system where you're using Knife? What version is running on the Chef Server? (I presume that with a 'url:4000' chef_server_url you're running your own server instead of Opscode's).

You can get additional information out of knife with '-VV'.

knife node edit -c knife.rb -e vim -VV

The setting in the knife.rb for the default environment to use is environment. On the node itself, chef_environment is a method to the Node object that returns the value of the node's environment and it is not an attribute.

Also, I'd recommend putting knife.rb in the .chef directory of your Chef Repository, or in your home directory. Knife will detect the configuration automatically by looking for .chef/knife.rb, similar to git.

Knife will also use the editor specified in the shell environment variable, EDITOR, too.

export EDITOR=`which vim`

Will have it use vim.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.