Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does `Chef::Config[:file_cache_path]` do exactly?

Tags:

chef-infra

First off, I apologize for asking such a dumb question. But the reason I ask is because I'm having a hard time finding an answer. I've tried searching Chef's docs, but I have not found a clear explanation.

So what exactly doesChef::Config[:file_cache_path] provide? I've read that its better to use this instead of harding coding a filepath. But what does it evaluate to?

In this particular snippet

newrelic_agent = Chef::Config[:file_cache_path] + '/rewrelic_nginx_agent.tar.gz'


remote_file newrelic_agent do
  source 'http://nginx.com/download/newrelic/newrelic_nginx_agent.tar.gz'
  mode "0744"
end

Thanks in advance.

like image 249
switchflip Avatar asked Sep 29 '14 20:09

switchflip


People also ask

How do I configure chef workstation to work with chef-run?

Chef Workstation will create config.toml the first time you use chef-run, if one does not already exist. To configure other tools, see their respective pages found in the toolbar under Chef Workstation Tools. Chef Workstation looks for the config.toml in a default location. Configure telemetry behaviors for Chef Workstation components.

What is Chef-Automate init-config?

The chef-automate init-config command generates an annotated Chef Automate configuration file with the basic settings needed to deploy Chef Automate. This section describes those settings and how to change them on an existing Chef Automate installation.

How do I change the configuration of a chef automate configuration?

chef-automate config patch </path/to/partial-config.toml> updates an existing Chef Automate configuration by merging the contents of </path/to/partial-config.toml> with your current Chef Automate configuration, and applying any changes. This command is enough in most situations

What is the default file path in chef infra client?

The full path to the file, including the file name and its extension. For example: /files/file.txt. Default value: the name of the resource block. See “Syntax” section above for more information. Microsoft Windows: A path that begins with a forward slash ( / ) will point to the root of the current working directory of Chef Infra Client process.


1 Answers

The specific value varies by platform and method of install, but that config value defaults to somewhere you can write out temp files. Generally it will be something like /var/chef/cache. This is used for caching cookbooks and files in them, but as you noted you can also use it from your own code for the same kind of thing.

like image 59
coderanger Avatar answered Nov 24 '22 06:11

coderanger