【发布时间】:2018-06-11 18:24:55
【问题描述】:
我用谷歌搜索了一下,似乎可以做到,但显然我做错了。
所以我正在尝试运行powershell_script 的这个 sn-p:
powershell_script 'Unzip' do
code <<-EOH
Expand-Archive -Path 'E:\\apache-tomee-1.7.4-plus.zip' -DestinationPath "E:\\#{node['COOKBOOK']['Product']}-#{node['COOKBOOK']['Region']}-" + count.to_s.rjust(2, "0")"
EOH
guard_interpreter :powershell_script
not_if "Test-Path -Path E:\\#{node['COOKBOOK']['Product']}-#{node['COOKBOOK']['Region']}-01"
end
现在这些节点属性在属性 default.rb 中设置
default['COOKBOOK']['Product'] = 'product'
default['COOKBOOK']['Region'] = 'region'
我在从那里获取到规范文件中应该包含的内容时遇到了问题。
require 'spec_helper'
describe 'COOKBOOK::default' do
context 'when all attributes are default, on Windows 2012R2' do
let(:chef_run) do
# for a complete list of available platforms and versions see:
# https://github.com/customink/fauxhai/blob/master/PLATFORMS.md
runner = ChefSpec::ServerRunner.new(platform: 'windows', version: '2012R2')
runner.converge(described_recipe)
end
it 'converges successfully' do
stub_command('Test-Path -Path E:\\#{node['COOKBOOK']['Product']}-#{node['COOKBOOK']['Region']}-01').and_return(true)
expect { chef_run }.to_not raise_error
end
end
end
谁能帮帮我?
提前致谢。
【问题讨论】:
-
您遇到错误了吗?究竟是什么问题?
标签: chef-infra chefspec