本文介绍了“ Chef :: Config [:file_cache_path]”到底能做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我很抱歉提出这样一个愚蠢的问题。但是我问的原因是因为我很难找到答案。我尝试搜索Chef的文档,但没有找到明确的解释。

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.

那么 Chef :: Config [:file_cache_path]到底能做什么? 提供?我读到最好用它而不是对文件路径进行编码。但是它的计算结果是什么?

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?

在此特定代码段中

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

推荐答案

具体值因平台和安装方法而异,但该配置值默认为您可以编写的位置临时文件。通常,它类似于 / var / chef / cache
用于缓存食谱和其中的文件,但正如您指出的,您还可以从自己的代码中使用它。

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.

这篇关于“ Chef :: Config [:file_cache_path]”到底能做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 18:00