Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 test.domain.com -c knife.rb -e vim
ERROR: ArgumentError: Attribute chef_environment is not defined!

I have an environment set up:

# knife environment list
  _default
  production

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

1 Answer 1

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 test.example.com -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

 
discard

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.