에 사용 된 backend.key=<%= node['key']%
> 소스에서 사용 된 템플릿 오류로 인해 쉘 아웃을 실행하는 동안 값이 없습니다.런타임에 노드 속성을 설정하고이를 셰프 템플릿에서 참조 할 수 없습니다.
Error : Chef::Mixin::Template::TemplateError - undefined method `[]' for nil:NilClass
는 I 파일 cat /tmp/key.txt
및 노드 값 할당의 출력을 얻을 수있는 루비 블록을 갖는다.
루비 블록 :
ruby_block "Get_key" do
block do
#tricky way to load this Chef::Mixin::ShellOut utilities
Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut)
command = 'cat /tmp/key.txt'
command_out = shell_out(command)
node.set['key'] = command_out.stdout
end
action :create
end
ERB :
backend.key=<%= node['key']%>
나는 꽤 비슷한 일을 [여기]를하고있는 중이 야 (https://github.com/TYPO3-cookbooks/gerrit/blob/fc82b9d82663f040116aed62bdcc3991e858ab98/recipes/peer_keys.rb) – StephenKing