salt-projecttest-kitchen

test kitchen salt_solo passing in variables from platforms


I am running test kitchen with salt using salt_solo and I cannot pass variables into the formula if I declare them in the platform.

For example if this was my .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  

Then my formula is not able to access {{grains['org']['bat']}}, but it is able to access {{grains['org']['foo']}}.


Solution

  • The solution is to add provisioner: before the platform variables. This fix to the example .kitchen.yml from above will solve the issue:

    ---
    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