cache_path = Chef::Config[:file_cache_path]
puts "=========================="
test1 = ::File.join("#{cache_path}\\#{node['ms_redistributable_2017_64']['windows_pkg']}")
puts test1
reboot 'restart_server' do
action :nothing
reason 'Reboot is necessary!'
end
remote_file ::File.join("#{cache_path}\\#{rd_exe}") do
source ::File.join("#{node['test-citrix-agents']['windows_source']}/#{node['ms_redistributable_2017_64']['windows_pkg']}")
headers ({"username"=>"artifactory_username", "password"=>"artifactory_api_key"})
checksum "#{node['ms_redistributable_2017_64']['checksum']}"
action :create_if_missing
not_if { ::File.exists?(::File.join("#{cache_path}\\#{node['ms_redistributable_2017_64']['windows_pkg']}") }
end已经编了几天了!不知道这有什么问题。请救救我
发布于 2020-07-28 09:23:46
问题最终解决了
necessary
仍会造成额外的空间错误。
发布于 2020-07-26 07:00:47
不确定使用node.default为变量赋值将有效。当我们想要在菜谱中为节点变量设置一个值时,通常会用到这一点。
示例:
node.default['my_cookbook']['var'] = 'somevalue'然而,当您希望将节点变量的值赋值给另一个变量时:
dload_checksum = node['ms_redistributable_2017_64']['checksum']
rd_path = "C:\\agents\\#{node['ms_redistributable_2017_64']['windows_pkg']}"
dload_source = "#{node['test-citrix-agents']['windows_source']}/#{node['ms_redistributable_2017_64']['windows_pkg']}"此外,在您的remote_file资源中,您可以使用上面定义的变量:
checksum dload_checksum
not_if { ::File.exists?(rd_path) }更新
除了堆栈跟踪之外,您能用运行期间显示的Cookbook Trace和Relevant File Content:更新问题吗?
类似于:
Cookbook Trace: (most recent call first)
----------------------------------------
C:/Chef/cache/cookbooks/cookbook1/recipes/default.rb:28:in `from_file'
Relevant File Content:
----------------------
C:/Chef/cache/cookbooks/cookbook1/recipes/default.rb:
26: end
27:
28>> node['cookbook1']['var'].each do |var|
29: file "c:/Users/Public/#{var}" dohttps://stackoverflow.com/questions/63085963
复制相似问题