Search code examples
supervisordsalt-project

Start supervisor from staltstack


I am trying to start supervisor in one of my minons. I have a .sls file with the following content:

service:
  supervisord.running:
    - require:
      - pkg: supervisor
    - update: True
    - watch:
      - file: /etc/supervisor.conf

which results in an error message:

      ID: service
Function: supervisord.running
  Result: False
 Comment: service: ERROR (no such process)
 Started: 11:30:18.515925
Duration: 270.551 ms
 Changes:

What am I doing wrong?


Solution

  • By default Salt takes the state id (the top key you named as service) as name key for your state. According to documentation here, state supervisord.running uses name for "Service name as defined in the supervisor configuration file".

    I guess you meant something else instead of service. In this case just add name key explicitly, like this:

    service:
      supervisord.running:
        - name: PUT_YOUR_CORRECT_SERVICE_NAME_HERE
        - require:
          - pkg: supervisor
        - update: True
        - watch:
          - file: /etc/supervisor.conf
    

    Make sure that service name PUT_YOUR_CORRECT_SERVICE_NAME_HERE exists in your "supervisor configuration file".

    I also suggest to change state id to something more specific than service as it requires to be globally unique, for example, supervisor_SERVICE_NAME:

    supervisor_SERVICE_NAME:
      supervisord.running:
        # ...