salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-master service state is never "clean"

Open jessecollier opened this issue 12 years ago • 9 comments

So I've added salt-master to my configs, and it "works" but when running a test I always see this

          ID: salt-master
    Function: service.running
      Result: None
     Comment: Service salt-master is set to start
     Changes:

When I run highstate it returns

          ID: salt-master
    Function: service.running
      Result: True
     Comment: Service salt-master is already enabled, and is running
     Changes:
              ----------
              salt-master:
                  True

What am I doing wrong!? It's driving me crazy.

jessecollier avatar Jun 20 '14 21:06 jessecollier

Oh here is my state file

salt-master:
  pkgrepo.managed:
    - humanname: SaltStack PPA
    - name: deb http://ppa.launchpad.net/saltstack/salt/ubuntu {{ grains['lsb_distrib_codename'] }} main
    - dist: {{ grains['lsb_distrib_codename'] }}
    - file: /etc/apt/sources.list.d/saltstack-salt-trusty.list
    - keyid: 0E27C0A6
    - keyserver: keyserver.ubuntu.com
    - require_in:
      - pkg: salt-master
      - pkg: salt-cloud
  pkg.installed:
    - name: salt-master
    - enabled: True
    - order: 1
  service.running:
    - name: salt-master
    - enable: True
    - watch:
      - file: salt-master
      - pkg: salt-master
  file.managed:
    - name: /etc/salt/master
    - template: jinja
    - source: salt://salt/files/master

jessecollier avatar Jun 20 '14 21:06 jessecollier

Please provide the Salt version running on your master and minion.

Also, when you say "running a test", what exactly do you mean by that? Are you running the states with the test=True argument for state.sls/state.highstate?

terminalmage avatar Jun 22 '14 21:06 terminalmage

Ah, it looks like the test=True version of service.running is not actually checking for whether the service is running or not. (The non test version probably doesn't either, I bet it just calls service <service> start or similar. We should probably make the checks a bit smarter here to improve the test output.

basepi avatar Jun 24 '14 19:06 basepi

(btw, a salt --versions-report would still be very welcome)

basepi avatar Jun 24 '14 19:06 basepi

@basepi yes, that sounds about right.

Here ya go:

           Salt: 2014.1.5
         Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
 msgpack-python: 0.3.0
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
         PyYAML: 3.10
          PyZMQ: 14.0.1
            ZMQ: 4.0.4

jessecollier avatar Jun 24 '14 19:06 jessecollier

So I've done some more digging... I believe it's a bug with upstart + forking.

~$ status salt-master
salt-master stop/waiting
~$ service salt-master status
salt-master stop/waiting
~$ /etc/init.d/salt-master status
/usr/bin/salt-master salt-master
 * salt-master is running
2014-06-25 19:25:53,135 [salt.loaded.int.module.cmdmod][INFO    ] Executing command 'service salt-master status' in directory '/root'
2014-06-25 19:25:53,199 [salt.loaded.int.module.cmdmod][INFO    ] output: salt-master stop/waiting
2014-06-25 19:25:53,200 [salt.loaded.int.module.cmdmod][INFO    ] Executing command 'service salt-master start' in directory '/root'
2014-06-25 19:25:53,301 [salt.loaded.int.module.cmdmod][INFO    ] output: salt-master start/running, process 11550

jessecollier avatar Jun 25 '14 19:06 jessecollier

I think I got it to work by adding export fork before the script section in /etc/init/salt-master.conf. This should clear the issue up. I'll let you know if it stays that way:

~$ status salt-master
salt-master start/running, process 12202

Edit: Upstart documentation http://upstart.ubuntu.com/cookbook/#when-wrong-pid-is-tracked

jessecollier avatar Jun 25 '14 19:06 jessecollier

Awesome! Thanks for clearing this up! I'm going to close this for now, but if your fix turns out to not be the correct one, don't hesitate to comment!

basepi avatar Jun 25 '14 23:06 basepi

I've made the change locally, and so far have not snagged the bug yet.... so far so good :)

jessecollier avatar Jun 25 '14 23:06 jessecollier