Chef-shell , how do I use environments


I am editing my earlier post, I can get around this problem by changing the config file:

 environment_path '/var/chef/environments'

However, that leads to other issues - with cookbook version constraints in the environment:

 Chef::Exceptions::IllegalVersionConstraint: Environment cookbook version constraints not allowed in chef-solo

So I will answer my post with: "One cannot use environments with chef-shell (v12, standalone or solo sessions).

I am trying to use an environment with chef-shell, and wondering if I am doing this correctly.

Adding “environment ‘default’” to the configuration seems to work with chef-client, but not with chef-shell - I get an exception

/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.12.15/lib/chef/environment.rb:255:in `directory?': no implicit conversion of Array into String (TypeError)

I took a look at this using pry, clearly it is getting a list of paths for the environment, and the ruby method expects a string type (not the array type),

255: def self.load_from_file(name)
    256:  binding.pry
 => 257:   unless[:environment_path])
    258:     raise Chef::Exceptions::InvalidEnvironmentPath, "Environment path '#{Chef::Config[:environment_path]}' is invalid"
    259:   end

[1] pry(Chef::Environment)> name
=> "default"
[2] pry(Chef::Environment)> Chef::Config[:environment_path]
=> ["/var/chef/environments", "/root/setup/environments"]
[3] pry(Chef::Environment)>[:environment_path])
TypeError: no implicit conversion of Array into String
from (pry):3:in `directory?'