fredrik
fredrik

Reputation: 10281

How to execute pkg.refresh_db in a salt state?

I have the following sls file:

python:
  pkg.installed:
    - pkgs:
      - python2_x64

How can I edit this file to make sure pkg.refresh_db is executed prior to attepting to install Python?

I can manually run the refresh like this: salt -G 'os:windows' pkg.refresh_db

Upvotes: 0

Views: 1420

Answers (2)

sebastian
sebastian

Reputation: 2506

Add refresh: True to the pkg.installed state:

python:
  pkg.installed:
    - pkgs:
      - python2_x64
    - refresh: True

or even shorter:

python2_x64:
  pkg.installed:
    - refresh: True

Upvotes: 0

fredrik
fredrik

Reputation: 10281

pkg:
module.run:
  - name: pkg.refresh_db

python:
pkg.installed:
  - pkgs:
    - python2_x64

Upvotes: 1

Related Questions