Chef infra 无法读取配方中的数据包项目

Chef infra 无法读取配方中的数据包项目,chef-infra,databags,Chef Infra,Databags,我是厨师架构的新手。我想在数据包中保留一些数据值,如共享位置路径、用户名、密码(不加密),并在配方中引用它们,而不是硬编码它们,但当我在配方中引用它们时,引用不会得到评估 请在下面找到我使用的脚本示例: databag details: databag name = ak-databag databag_item name= uncpath databag entries- id: uncpath unc-path: \\ec2-999-33

我是厨师架构的新手。我想在数据包中保留一些数据值,如共享位置路径、用户名、密码(不加密),并在配方中引用它们,而不是硬编码它们,但当我在配方中引用它们时,引用不会得到评估

请在下面找到我使用的脚本示例:

databag details: databag name = ak-databag
             databag_item name= uncpath

databag entries-     id: uncpath
         unc-path: \\ec2-999-333-111-444.ap-southeast-1.compute.amazonaws.com\share

script:
 batch "Copy_product1_and_product2"
  code <<-EOH
            net use "my_bag["unc-path"]" password /user:username
            xcopy "my_bag["unc-path"]\\product1.exe"  "C:\\my-Package1" /y /S
            xcopy "my_bag["unc-path"]\\product2.exe"  "C:\\my-Package2" /y /S
           EOH
end
databag详细信息:databag name=ak databag
数据包_项目名称=uncpath
数据包条目-id:uncpath
unc路径:\\ec2-999-333-111-444.ap-southest-1.compute.amazonaws.com\share
脚本:
批量“复制产品1和产品2”

代码您以前是否调用过类似于
my\u bag=data\u bag\u item(“ak数据包”、“uncpath”)
的东西?(示例中未显示)。您的主要问题可能是插值,即:
net-use“my_-bag[“unc-path”]”
应该是
net-use“{my_-bag['unc-path']}”
是的,这都是关于错过的“#”,非常感谢您的快速响应!