0

I'm working on a salt state to deploy a python app. It's mostly working. One issue I have is that pip install run every time the salt minion runs. I only want it to run when there is a new commit in the git checkout. I tried a both onchange and watch requirements, but this did not help.

This is my salt state:

dmt src:
  git.latest:
    - target: /opt/dmt/src/dmt
    - name: git@gitlab.xyz.co.za:lsd/dmt.git
    - identity: /opt/dmt/src/deploy_id_rsa
    - force: True
    - force_checkout: True
    - force_reset: True
    - require:
      - file: /opt/dmt/src
      - file: /opt/dmt/src/deploy_id_rsa


dmt virtualenv:
  virtualenv.managed:
    - name: /opt/dmt
    - system_site_packages: False
    - use_wheel: True
    - python: /usr/bin/python2

dmt pip install:
  pip.installed:
    - onchange:
      - git: dmt src
    - requires:
      - virtualenv: dmt virtualenv
    - name: ""
    - pip_bin: /opt/dmt/bin/pip
    - editable: /opt/dmt/src/dmt

How can I make the pip install only run when there is a new commit in the git checkout?

  • Hi Gary. Was this question answered? – Dan Garthwaite Apr 24 '15 at 17:29
0

I believe it is plural: "onchanges"

dmt pip install:
  pip.installed:
    - onchanges:
      - git: "dmt src"
    - requires:
      - virtualenv: "dmt virtualenv"
    {# ...snip... #}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.