How to use script resource to substitute variable

2019-09-02 05:08发布

This question already has an answer here:

I am using chef script resource and trying to assign a fingerprint value as below

script 'retrieve_ucp_master_fingerprint' do  
  interpreter "bash"  
  code <<-EOH  
      export FINGERPRINT=D0:19:C5:80:42:66:56:AC:6F  
      docker run --rm -i -v /var/run/docker.sock:/var/run/docker.sock --name ucp docker/ucp join --replica --fingerprint $FINGERPRINT
  EOH  
end    

However, chef is not at all substituting the value of $FINGERPRINT

1条回答
太酷不给撩
2楼-- · 2019-09-02 05:53

$FINGERPRINT is bash syntax, Chef is not involved. You can use #{} to interpolate Ruby expressions in some kinds of Ruby string literals, but you would have to say where that data is coming from.

查看更多
登录 后发表回答