2017-06-13 66 views
0

我正在使用salt_solo運行鹽測試廚房,如果我在平臺中聲明它們,我無法將變量傳遞到公式中。測試廚房salt_solo傳遞來自平臺的變量

例如,如果這是我的.kitchen.yml

--- 
driver: 
    name: vagrant 

platforms: 
    - name: ubuntu-14.04 
    grains: 
     org: 
     bat: batz 

suites: 
    - name: binary 
    provisioner: 
     name: salt_solo 
     state_top: 
     base: 
      '*': 
      - binary 
     formula: binary 
     grains: 
     org: 
      foo: bar 

然後我的公式是不能夠訪問{{grains['org']['bat']}},但它能夠訪問{{grains['org']['foo']}}

回答

0

解決方法是在平臺變量前添加provisioner:。從上面修復示例.kitchen.yml將解決此問題:

--- 
driver: 
    name: vagrant 

platforms: 
    - name: ubuntu-14.04 
    provisioner: 
     grains: 
     org: 
      bat: batz 

suites: 
    - name: binary 
    provisioner: 
     name: salt_solo 
     state_top: 
     base: 
      '*': 
      - binary 
     formula: binary 
     grains: 
     org: 
      foo: bar