salt
salt copied to clipboard
Refuse to start master if ports can't be opened
I encountered this when upgrading the Ubuntu package from 0.9.9 to 0.10. Starting the master seems to succeed:
djs-admin@thames:~$ sudo /etc/init.d/salt-master stop
* Stopping salt master control daemon salt-master
* Stopping salt master control daemon ... [ OK ]
[ OK ]
djs-admin@thames:~$ sudo /etc/init.d/salt-master start
* Starting salt master control daemon salt-master
* Starting salt-master daemon: [ OK ]
[ OK ]
but salt commands were hanging. Running salt-master at the command line showed that it couldn't open the ports:
djs-admin@thames:~$ sudo salt-master -l debug
11:57:15,947 [salt.crypt ][DEBUG ] Loaded master key: /etc/salt/pki/master.pem
11:57:16,130 [salt.master ][INFO ] Preparing the root key for local communication
11:57:16,130 [salt.master ][WARNING ] Starting the Salt Master
11:57:16,161 [salt.master ][INFO ] Setting up the master communication server
Traceback (most recent call last):
File "/usr/bin/salt-master", line 10, in <module>
salt_master()
File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 16, in salt_master
master.start()
File "/usr/lib/pymodules/python2.7/salt/__init__.py", line 113, in start
master.start()
File "/usr/lib/pymodules/python2.7/salt/master.py", line 190, in start
reqserv.run()
File "/usr/lib/pymodules/python2.7/salt/master.py", line 317, in run
self.__bind()
File "/usr/lib/pymodules/python2.7/salt/master.py", line 273, in __bind
self.clients.bind(self.uri)
File "socket.pyx", line 489, in zmq.core.socket.Socket.bind (zmq/core/socket.c:4797)
11:57:16,185 [salt.master ][INFO ] Starting the Salt Publisher on tcp://0.0.0.0:4505
zmq.core.error.ZMQError: Address already in use
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.7/multiprocessing/util.py", line 295, in _exit_function
p.join()
File "/usr/lib/python2.7/multiprocessing/process.py", line 145, in join
res = self._popen.wait(timeout)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 148, in wait
return self.poll(0)
File "/usr/lib/python2.7/multiprocessing/forking.py", line 133, in poll
pid, sts = os.waitpid(self.pid, flag)
but this did not cause the process to exit, and so the service start command looks like it succeeds. It would be better to exit with an error message in this case.
(in this case, I had an old salt-master process running; killing it got things working again as normal)
Thanks, I will get this fixed!