0

I have a state like

django.syncdb:
    module.run:
        - settings_module: mvod.dev_settings
        - bin_env: /home/vagrant/virtualenv/
        - migrate: True
        - require:
            - pip: mvod
            - mysql_grants: mvod_user_grants
            - file: /tmp/mvod.log

The docs aren't very specific about what this exactly does, though it indeed does seem to do what I expect, meaning run the command django-admin.py syncdb --settings=mvod.dev_settings --migrate from inside the directory /home/vagrant/virtualenv.

It actually fails to do this, since the /home/vagrant/virtualenv/ path actually needs to set to /home/vagrant/virtualenv/bin/django-admin.py.

However, i ran this in an environment where django wasn't installed, and so i'd expect this to fail. The state however returned Result: True but then the output was this Is a directory

I figured out eventually that i have to replace the line bin_env: /home/vagrant/virtualenv/ with bin_env: /home/vagrant/virtualenv/bin/django-admin.py since that's what i was trying to call.

Bottom line: i would have figured it out much sooner had i had a way of turning the state into the exact command being executed.

So is there a way to do this real fast?

vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
  • Did you find a solution? Same problem over here. Neither -l debug nor logfile (/var/log/salt/minion) actually show the command. Version: salt-minion 2015.5.8 (Lithium) – kev May 16 '16 at 05:15

1 Answers1

1

You can run the minion as salt-minion --log-level=debug and then execute the state. It will show you what commands are being executed by salt on the system based on your state file.

nmadhok
  • 1,704
  • 3
  • 16
  • 20