Errors changing file_cache_path using chef-client cookbook during bootstrap


#1

Hi

We need to change the file_cache_path to point to a different location, so
I have this in my env

          :chef_client => {
                    :config => {
                      :file_cache_path => "D:\\chef\\cache",
                      :file_backup_path => "D:\\chef\\backup"
                    }
     },

I’m using the chef-client::config recipe to manage client.rb, but it seems
the reload of the config doesn’t effect the current run, since the new
directories are not created so a later recipe (that tries to download to
the cache folder) fails. See output below.

The client.rb is updated to have the correct settings.

The rather strange thing is that the chef-stacktrace file is written to the
new cache dir on the D: drive, so next time I run chef-client things are
working…

Any hints?

/Jeppe

172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/run] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/run]
created directory C:/chef/run
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/run]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/run]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/cache] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/cache]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/cache]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/backup] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/backup]
created directory C:/chef/backup
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/backup]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/backup]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/log] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
created directory C:/chef/log
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
permissions changed to
[WIN-6G50U0QH101\Administrator/flags:0/mask:e0010000,
BUILTIN\Administrators/flags:0/mask:a0000000]
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef] owner
changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef] group
changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
template[C:/chef/client.rb] action create (chef-client::config line 73)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: template[C:/chef/client.rb]
backed up to c:/chef/backup/chef/client.rb.chef-20140904000902.422562
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: template[C:/chef/client.rb]
updated file contents C:/chef/client.rb
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: template[C:/chef/client.rb]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: template[C:/chef/client.rb]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: template[C:/chef/client.rb]
permissions changed to
[WIN-6G50U0QH101\Administrator/flags:0/mask:c0010000,
BUILTIN\Administrators/flags:0/mask:80000000,
Everyone/flags:0/mask:80000000]
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: template[C:/chef/client.rb]
sending create action to ruby_block[reload_client_config] (immediate)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
ruby_block[reload_client_config] action create (chef-client::config line 96)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
ruby_block[reload_client_config] called
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
directory[C:/chef/client.d] action create (chef-client::config line 89)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: directory[C:/chef/client.d]
created directory C:/chef/client.d
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: directory[C:/chef/client.d]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: directory[C:/chef/client.d]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: directory[C:/chef/client.d]
permissions changed to
[WIN-6G50U0QH101\Administrator/flags:0/mask:e0010000,
BUILTIN\Administrators/flags:0/mask:a0000000,
Everyone/flags:0/mask:a0000000]
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
ruby_block[reload_client_config] action nothing (chef-client::config line
96)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
ohai[custom_hints] action nothing (base-econ::configure_ohai line 37)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
windows_feature[IIS-WebServerRole] action install (iis::default line 22)
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO:
windows_feature[IIS-WebServerRole] installed feature
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO: Processing service[iis]
action enable (iis::default line 27)
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO: Processing service[iis]
action start (iis::default line 27)
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO: Processing
windows_feature[IIS-ISAPIFilter] action install (iis::mod_isapi line 30)
172.27.28.220 [2014-09-04T00:09:20-07:00] INFO:
windows_feature[IIS-ISAPIFilter] installed feature
172.27.28.220 [2014-09-04T00:09:20-07:00] INFO: Processing
windows_feature[IIS-ISAPIExtensions] action install (iis::mod_isapi line 30)
172.27.28.220 [2014-09-04T00:09:23-07:00] INFO:
windows_feature[IIS-ISAPIExtensions] installed feature
172.27.28.220 [2014-09-04T00:09:23-07:00] INFO: Processing
windows_feature[NetFx3] action install (iis-econ::default line 25)
172.27.28.220 [2014-09-04T00:09:42-07:00] INFO: windows_feature[NetFx3]
installed feature
172.27.28.220 [2014-09-04T00:09:42-07:00] INFO: Processing
windows_feature[IIS-ASP] action install (iis-econ::default line 25)
172.27.28.220 [2014-09-04T00:09:47-07:00] INFO: windows_feature[IIS-ASP]
installed feature
172.27.28.220 [2014-09-04T00:09:47-07:00] INFO: Processing
windows_feature[IIS-NetFxExtensibility] action install (iis::mod_aspnet
line 31)
172.27.28.220 [2014-09-04T00:10:01-07:00] INFO:
windows_feature[IIS-NetFxExtensibility] installed feature
172.27.28.220 [2014-09-04T00:10:01-07:00] INFO: Processing
windows_feature[IIS-ASPNET] action install (iis::mod_aspnet line 31)
172.27.28.220 [2014-09-04T00:10:06-07:00] INFO: windows_feature[IIS-ASPNET]
installed feature
172.27.28.220 [2014-09-04T00:10:06-07:00] INFO: Processing iis_site[Default
Web Site] action stop (iis-econ::default line 33)
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: iis_site[Default Web Site]
stopped
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: Processing iis_site[Default
Web Site] action delete (iis-econ::default line 33)
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: iis_site[Default Web Site]
deleted
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: Processing
windows_feature[TelnetClient] action install (base-econ::base-windows line
12)
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO:
windows_feature[TelnetClient] installed feature
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO: Processing
windows_package[NXLOG-CE] action install (nxlog::install line 2)
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO: Installing
windows_package[NXLOG-CE] version 2.7.1191
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO: Processing
remote_file[D:\chef\cache/nxlog-ce-2.7.1191.msi] action create (dynamically
defined)
172.27.28.220
172.27.28.220

172.27.28.220 Error executing action create on resource
’remote_file[D:\chef\cache/nxlog-ce-2.7.1191.msi]'
172.27.28.220

172.27.28.220
172.27.28.220 Chef::Exceptions::EnclosingDirectoryDoesNotExist
172.27.28.220 ------------------------------------------------
172.27.28.220 Parent directory D:\chef\cache does not exist.


#2

You have a forward slash in there instead of a backslash. But I doubt
that’s the issue. Looks more like it’s exactly what you think the issue
is. I don’t have a fix for that but I do have a recommendation:

This type of nonsense is exactly why I stopped using the chef-client
cookbook. For the long-run I suggest you not manage the config file with
chef. I manage the client config with bootstrap. Managing through
bootstrap will allow you to change settings and/or upgrade the client and
the changes will be in affect for that run. You won’t have to wait until
the next which can be frustrating especially if you don’t run chef-client
in daemon mode. So just simply re-bootstrap the node with the proper
settings.

I’m sure some will disagree with that approach but the whole idea of
managing the client through a cookbook always smelled to me. Maybe it’s my
inner control freak but the fact that your client could/would have
different settings the first time your run as opposed to subsequent runs
and the fact that when I made changes I’d have to wait until a subsequent
run for them to take affect made removing that from our runlist my first
priority when started at my current company.

So says me :slight_smile:

On Thu, Sep 4, 2014 at 1:00 AM, Jeppe Nejsum Madsen jeppe@ingolfs.dk
wrote:

Hi

We need to change the file_cache_path to point to a different location, so
I have this in my env

          :chef_client => {
                    :config => {
                      :file_cache_path => "D:\\chef\\cache",
                      :file_backup_path => "D:\\chef\\backup"
                    }
     },

I’m using the chef-client::config recipe to manage client.rb, but it seems
the reload of the config doesn’t effect the current run, since the new
directories are not created so a later recipe (that tries to download to
the cache folder) fails. See output below.

The client.rb is updated to have the correct settings.

The rather strange thing is that the chef-stacktrace file is written to
the new cache dir on the D: drive, so next time I run chef-client things
are working…

Any hints?

/Jeppe

172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/run] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/run]
created directory C:/chef/run
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/run]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/run]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/cache] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/cache]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/cache]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/backup] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/backup]
created directory C:/chef/backup
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/backup]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/backup]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef/log] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
created directory C:/chef/log
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
owner changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef/log]
permissions changed to
[WIN-6G50U0QH101\Administrator/flags:0/mask:e0010000,
BUILTIN\Administrators/flags:0/mask:a0000000]
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
directory[C:/chef] action create (chef-client::config line 77)
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef] owner
changed to S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: directory[C:/chef] group
changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:01-07:00] INFO: Processing
template[C:/chef/client.rb] action create (chef-client::config line 73)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
template[C:/chef/client.rb] backed up to
c:/chef/backup/chef/client.rb.chef-20140904000902.422562
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
template[C:/chef/client.rb] updated file contents C:/chef/client.rb
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
template[C:/chef/client.rb] owner changed to
S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
template[C:/chef/client.rb] group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
template[C:/chef/client.rb] permissions changed to
[WIN-6G50U0QH101\Administrator/flags:0/mask:c0010000,
BUILTIN\Administrators/flags:0/mask:80000000,
Everyone/flags:0/mask:80000000]
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
template[C:/chef/client.rb] sending create action to
ruby_block[reload_client_config] (immediate)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
ruby_block[reload_client_config] action create (chef-client::config line 96)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
ruby_block[reload_client_config] called
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
directory[C:/chef/client.d] action create (chef-client::config line 89)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
directory[C:/chef/client.d] created directory C:/chef/client.d
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
directory[C:/chef/client.d] owner changed to
S-1-5-21-1358994766-942838864-10853432-500
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
directory[C:/chef/client.d] group changed to S-1-5-32-544
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO:
directory[C:/chef/client.d] permissions changed to
[WIN-6G50U0QH101\Administrator/flags:0/mask:e0010000,
BUILTIN\Administrators/flags:0/mask:a0000000,
Everyone/flags:0/mask:a0000000]
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
ruby_block[reload_client_config] action nothing (chef-client::config line
96)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
ohai[custom_hints] action nothing (base-econ::configure_ohai line 37)
172.27.28.220 [2014-09-04T00:09:02-07:00] INFO: Processing
windows_feature[IIS-WebServerRole] action install (iis::default line 22)
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO:
windows_feature[IIS-WebServerRole] installed feature
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO: Processing service[iis]
action enable (iis::default line 27)
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO: Processing service[iis]
action start (iis::default line 27)
172.27.28.220 [2014-09-04T00:09:17-07:00] INFO: Processing
windows_feature[IIS-ISAPIFilter] action install (iis::mod_isapi line 30)
172.27.28.220 [2014-09-04T00:09:20-07:00] INFO:
windows_feature[IIS-ISAPIFilter] installed feature
172.27.28.220 [2014-09-04T00:09:20-07:00] INFO: Processing
windows_feature[IIS-ISAPIExtensions] action install (iis::mod_isapi line 30)
172.27.28.220 [2014-09-04T00:09:23-07:00] INFO:
windows_feature[IIS-ISAPIExtensions] installed feature
172.27.28.220 [2014-09-04T00:09:23-07:00] INFO: Processing
windows_feature[NetFx3] action install (iis-econ::default line 25)
172.27.28.220 [2014-09-04T00:09:42-07:00] INFO: windows_feature[NetFx3]
installed feature
172.27.28.220 [2014-09-04T00:09:42-07:00] INFO: Processing
windows_feature[IIS-ASP] action install (iis-econ::default line 25)
172.27.28.220 [2014-09-04T00:09:47-07:00] INFO: windows_feature[IIS-ASP]
installed feature
172.27.28.220 [2014-09-04T00:09:47-07:00] INFO: Processing
windows_feature[IIS-NetFxExtensibility] action install (iis::mod_aspnet
line 31)
172.27.28.220 [2014-09-04T00:10:01-07:00] INFO:
windows_feature[IIS-NetFxExtensibility] installed feature
172.27.28.220 [2014-09-04T00:10:01-07:00] INFO: Processing
windows_feature[IIS-ASPNET] action install (iis::mod_aspnet line 31)
172.27.28.220 [2014-09-04T00:10:06-07:00] INFO:
windows_feature[IIS-ASPNET] installed feature
172.27.28.220 [2014-09-04T00:10:06-07:00] INFO: Processing
iis_site[Default Web Site] action stop (iis-econ::default line 33)
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: iis_site[Default Web Site]
stopped
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: Processing
iis_site[Default Web Site] action delete (iis-econ::default line 33)
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: iis_site[Default Web Site]
deleted
172.27.28.220 [2014-09-04T00:10:07-07:00] INFO: Processing
windows_feature[TelnetClient] action install (base-econ::base-windows line
12)
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO:
windows_feature[TelnetClient] installed feature
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO: Processing
windows_package[NXLOG-CE] action install (nxlog::install line 2)
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO: Installing
windows_package[NXLOG-CE] version 2.7.1191
172.27.28.220 [2014-09-04T00:10:10-07:00] INFO: Processing
remote_file[D:\chef\cache/nxlog-ce-2.7.1191.msi] action create (dynamically
defined)
172.27.28.220
172.27.28.220

172.27.28.220 Error executing action create on resource
’remote_file[D:\chef\cache/nxlog-ce-2.7.1191.msi]'
172.27.28.220

172.27.28.220
172.27.28.220 Chef::Exceptions::EnclosingDirectoryDoesNotExist
172.27.28.220 ------------------------------------------------
172.27.28.220 Parent directory D:\chef\cache does not exist.