Chef env error


#1

Hi all,

       I ve running java,windows chef_handler,powershell cookbook,mysql,openssl,it shows a following error :

my java code for env:
#add java value in path variable

env “Path” do
action :modify
delim ::File::PATH_SEPARATOR
value node[‘java’][‘path’]
not_if {“Path”.include? node[‘java’][‘path’] }
end

[2014-08-06T22:27:55-07:00] INFO: env[Path] created
172.16.1.190
[2014-08-06T22:27:55-07:00] INFO: Processing windows_path[C:\Program
Files\MySQL\MySQL Server 5.5\bin] action add (mysql::_server_windows
line 7)
172.16.1.190
[2014-08-06T22:27:55-07:00] INFO: Processing env[PATH] action modify
(c:/chef/cache/cookbooks/windows/providers/path.rb line 22)
172.16.1.190
172.16.1.190 ================================================================================

172.16.1.190 Error executing action modify on resource 'env[PATH]'
172.16.1.190 ================================================================================
172.16.1.190
172.16.1.190 Chef::Exceptions::Env
172.16.1.190 ---------------------
172.16.1.190 Cannot modify env[PATH] - key does not exist!
172.16.1.190
172.16.1.190 Resource Declaration:
172.16.1.190 ---------------------
172.16.1.190 # In c:/chef/cache/cookbooks/windows/providers/path.rb
172.16.1.190
172.16.1.190 22: env “PATH” do
172.16.1.190 23: action :modify
172.16.1.190 24: delim ::File::PATH_SEPARATOR
172.16.1.190 25: value new_resource.path
172.16.1.190 26: end
172.16.1.190 27: end
172.16.1.190
172.16.1.190 Compiled Resource:
172.16.1.190 ------------------
172.16.1.190 # Declared in c:/chef/cache/cookbooks/windows/providers/path.rb:22:in `block in class_from_file’
172.16.1.190
172.16.1.190 env(“PATH”) do
172.16.1.190 action [:modify]
172.16.1.190 retries 0
172.16.1.190 retry_delay 2
172.16.1.190 guard_interpreter :default
172.16.1.190 key_name "PATH"
172.16.1.190 value "C:\Program Files\MySQL\MySQL Server 5.5\bin"
172.16.1.190 delim ";"
172.16.1.190 cookbook_name "mysql"
172.16.1.190 end
172.16.1.190
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Running queued delayed notifications before re-raising exception
172.16.1.190 [2014-08-06T22:27:55-07:00] ERROR: Running exception handlers
172.16.1.190
[2014-08-06T22:27:55-07:00] ERROR: Exception handlers complete
172.16.1.190 [2014-08-06T22:27:55-07:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Sending resource update report (run-id: fd53a514-74dc-4ba0-9966-f2c5ac75a436)
172.16.1.190
[2014-08-06T22:28:03-07:00] FATAL: Chef::Exceptions::Env: env[PATH]
(c:/chef/cache/cookbooks/windows/providers/path.rb line 22) had an
error: Chef::Exceptions::Env: Cannot modify env[PATH] - key does not
exist!

Thanks,Indra


#2

Indra, you are hitting a known issue in Chef 11.14.2. The only workaround
at the moment is to downgrade to Chef 11.12.8. We’re currently testing a
fix for this issue as well: https://github.com/opscode/chef/pull/1774.

My apologies for the regression.

-Adam

From: Indra k [mailto:indra.k@cloudenablers.com]
Sent: Wednesday, August 6, 2014 10:37 PM
To: chef@lists.opscode.com
Subject: [chef] chef env error

Hi all,

       I ve running java,windows chef_handler,powershell

cookbook,mysql,openssl,it shows a following error :

my java code for env:
#add java value in path variable

env “Path” do
action :modify
delim ::File::PATH_SEPARATOR
value node[‘java’][‘path’]
not_if {“Path”.include? node[‘java’][‘path’] }
end

[2014-08-06T22:27:55-07:00] INFO: env[Path] created
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Processing
windows_path[C:\Program Files\MySQL\MySQL Server 5.5\bin] action add
(mysql::_server_windows line 7)
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Processing env[PATH] action
modify (c:/chef/cache/cookbooks/windows/providers/path.rb line 22)
172.16.1.190
172.16.1.190

172.16.1.190 Error executing action modify on resource 'env[PATH]'
172.16.1.190

172.16.1.190
172.16.1.190 Chef::Exceptions::Env
172.16.1.190 ---------------------
172.16.1.190 Cannot modify env[PATH] - key does not exist!
172.16.1.190
172.16.1.190 Resource Declaration:
172.16.1.190 ---------------------
172.16.1.190 # In c:/chef/cache/cookbooks/windows/providers/path.rb
172.16.1.190
172.16.1.190 22: env “PATH” do
172.16.1.190 23: action :modify
172.16.1.190 24: delim ::File::PATH_SEPARATOR
172.16.1.190 25: value new_resource.path
172.16.1.190 26: end
172.16.1.190 27: end
172.16.1.190
172.16.1.190 Compiled Resource:
172.16.1.190 ------------------
172.16.1.190 # Declared in
c:/chef/cache/cookbooks/windows/providers/path.rb:22:in `block in
class_from_file’
172.16.1.190
172.16.1.190 env(“PATH”) do
172.16.1.190 action [:modify]
172.16.1.190 retries 0
172.16.1.190 retry_delay 2
172.16.1.190 guard_interpreter :default
172.16.1.190 key_name "PATH"
172.16.1.190 value "C:\Program Files\MySQL\MySQL Server 5.5\bin"
172.16.1.190 delim ";"
172.16.1.190 cookbook_name "mysql"
172.16.1.190 end
172.16.1.190
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Running queued delayed
notifications before re-raising exception
172.16.1.190 [2014-08-06T22:27:55-07:00] ERROR: Running exception handlers
172.16.1.190 [2014-08-06T22:27:55-07:00] ERROR: Exception handlers complete
172.16.1.190 [2014-08-06T22:27:55-07:00] FATAL: Stacktrace dumped to
c:/chef/cache/chef-stacktrace.out
172.16.1.190 [2014-08-06T22:27:55-07:00] INFO: Sending resource update
report (run-id: fd53a514-74dc-4ba0-9966-f2c5ac75a436)
172.16.1.190 [2014-08-06T22:28:03-07:00] FATAL: Chef::Exceptions::Env:
env[PATH] (c:/chef/cache/cookbooks/windows/providers/path.rb line 22) had
an error: Chef::Exceptions::Env: Cannot modify env[PATH] - key does not
exist!

Thanks,

Indra