复制到节点的文件为空
File copied to node is empty
我正在编写厨师食谱以将文件复制到节点,但文件最终为空,但未报告任何错误。
详情
我是厨师的新手,正在尝试编写一个食谱来将 jar 文件复制到 Ubuntu 盒子中,然后 运行 将其作为一项服务。从 ERB 模板生成服务的初始化脚本工作正常,但尝试使用 file
资源复制我的 jar 文件只会在节点上生成一个空文件。
我正在使用 kitchen 在本地 VM 上测试菜谱,kitchen 在 kitchen converge
期间没有报告任何错误。我可以使用 kitchen login
登录虚拟机,但正如我所提到的,jar 文件是空的。
这是我复制文件的块:
file "SmartTrackChecker-all.jar" do
action :create
path "/opt/#{project_name}/#{project_name}.jar"
owner user_name
group group_name
mode 0440
notifies 'restart', "service[#{service_name}]"
end
file 资源使用通过 content
参数指定的内容 - 这似乎不是必需的,默认为空。这就是(我猜)文件为空的原因。
您想使用 cookbook_file resource instead, which works the same as template 并从食谱的 files/
文件夹中获取文件。
我猜奇怪的命名模式是由历史造成的 reasons.file
cookbook_file "SmartTrackChecker-all.jar" do
action :create
path "/opt/#{project_name}/#{project_name}.jar"
owner user_name
group group_name
mode 0440
notifies 'restart', "service[#{service_name}]"
end
我正在编写厨师食谱以将文件复制到节点,但文件最终为空,但未报告任何错误。
详情
我是厨师的新手,正在尝试编写一个食谱来将 jar 文件复制到 Ubuntu 盒子中,然后 运行 将其作为一项服务。从 ERB 模板生成服务的初始化脚本工作正常,但尝试使用 file
资源复制我的 jar 文件只会在节点上生成一个空文件。
我正在使用 kitchen 在本地 VM 上测试菜谱,kitchen 在 kitchen converge
期间没有报告任何错误。我可以使用 kitchen login
登录虚拟机,但正如我所提到的,jar 文件是空的。
这是我复制文件的块:
file "SmartTrackChecker-all.jar" do
action :create
path "/opt/#{project_name}/#{project_name}.jar"
owner user_name
group group_name
mode 0440
notifies 'restart', "service[#{service_name}]"
end
file 资源使用通过 content
参数指定的内容 - 这似乎不是必需的,默认为空。这就是(我猜)文件为空的原因。
您想使用 cookbook_file resource instead, which works the same as template 并从食谱的 files/
文件夹中获取文件。
我猜奇怪的命名模式是由历史造成的 reasons.file
cookbook_file "SmartTrackChecker-all.jar" do
action :create
path "/opt/#{project_name}/#{project_name}.jar"
owner user_name
group group_name
mode 0440
notifies 'restart', "service[#{service_name}]"
end