mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Merge branch 'develop' of github.com:saltstack/salt into develop
This commit is contained in:
commit
1e625de5c1
@ -6,7 +6,7 @@ Salt comes with a simple file server suitable for distributing files to the
|
||||
salt minions. The file server is a stateless ZeroMQ server that is built into
|
||||
the salt master.
|
||||
|
||||
The main intent of the Salt File server is the present files for use in the
|
||||
The main intent of the Salt File server is to present files for use in the
|
||||
Salt state system. With this said, the Salt file server can be used for any
|
||||
general file transfer from the master to the minions.
|
||||
|
||||
|
@ -29,6 +29,7 @@ class Master(object):
|
||||
# command line overrides config
|
||||
if self.cli['user']:
|
||||
self.opts['user'] = self.cli['user']
|
||||
|
||||
# Send the pidfile location to the opts
|
||||
if self.cli['pidfile']:
|
||||
self.opts['pidfile'] = self.cli['pidfile']
|
||||
@ -97,7 +98,6 @@ class Master(object):
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
# Late import so logging works correctly
|
||||
if check_user(self.opts['user'], log):
|
||||
import salt.master
|
||||
master = salt.master.Master(self.opts)
|
||||
if self.cli['daemon']:
|
||||
@ -105,6 +105,7 @@ class Master(object):
|
||||
import salt.utils
|
||||
salt.utils.daemonize()
|
||||
set_pidfile(self.opts['pidfile'])
|
||||
if check_user(self.opts['user'], log):
|
||||
try:
|
||||
master.start()
|
||||
except salt.master.MasterExit:
|
||||
@ -186,13 +187,13 @@ class Minion(object):
|
||||
# Late import so logging works correctly
|
||||
import salt.minion
|
||||
log = logging.getLogger(__name__)
|
||||
if check_user(self.opts['user'], log):
|
||||
try:
|
||||
if self.cli['daemon']:
|
||||
# Late import so logging works correctly
|
||||
import salt.utils
|
||||
salt.utils.daemonize()
|
||||
set_pidfile(self.cli['pidfile'])
|
||||
if check_user(self.opts['user'], log):
|
||||
try:
|
||||
minion = salt.minion.Minion(self.opts)
|
||||
minion.tune_in()
|
||||
except KeyboardInterrupt:
|
||||
@ -303,14 +304,14 @@ class Syndic(object):
|
||||
# Late import so logging works correctly
|
||||
import salt.minion
|
||||
log = logging.getLogger(__name__)
|
||||
if check_user(self.opts['user'], log):
|
||||
try:
|
||||
syndic = salt.minion.Syndic(self.opts)
|
||||
if self.cli['daemon']:
|
||||
# Late import so logging works correctly
|
||||
import salt.utils
|
||||
salt.utils.daemonize()
|
||||
set_pidfile(self.cli['pidfile'])
|
||||
if check_user(self.opts['user'], log):
|
||||
try:
|
||||
syndic = salt.minion.Syndic(self.opts)
|
||||
syndic.tune_in()
|
||||
except KeyboardInterrupt:
|
||||
log.warn('Stopping the Salt Syndic Minion')
|
||||
|
@ -131,7 +131,6 @@ class Master(SMaster):
|
||||
'''
|
||||
Clean out the old jobs
|
||||
'''
|
||||
salt.utils.append_pid(self.opts['pidfile'])
|
||||
while True:
|
||||
cur = "{0:%Y%m%d%H}".format(datetime.datetime.now())
|
||||
|
||||
@ -207,7 +206,6 @@ class Publisher(multiprocessing.Process):
|
||||
'''
|
||||
Bind to the interface specified in the configuration file
|
||||
'''
|
||||
salt.utils.append_pid(self.opts['pidfile'])
|
||||
context = zmq.Context(1)
|
||||
pub_sock = context.socket(zmq.PUB)
|
||||
pull_sock = context.socket(zmq.PULL)
|
||||
@ -286,7 +284,6 @@ class ReqServer(object):
|
||||
'''
|
||||
Start up the ReqServer
|
||||
'''
|
||||
salt.utils.append_pid(self.opts['pidfile'])
|
||||
self.__bind()
|
||||
|
||||
|
||||
@ -376,7 +373,6 @@ class MWorker(multiprocessing.Process):
|
||||
'''
|
||||
Start a Master Worker
|
||||
'''
|
||||
salt.utils.append_pid(self.opts['pidfile'])
|
||||
self.__bind()
|
||||
|
||||
|
||||
|
@ -81,18 +81,6 @@ def get_colors(use=True):
|
||||
return colors
|
||||
|
||||
|
||||
def append_pid(pidfile):
|
||||
'''
|
||||
Save the pidfile
|
||||
'''
|
||||
try:
|
||||
open(pidfile, 'a').write('\n{0}'.format(str(os.getpid())))
|
||||
except IOError:
|
||||
err = ('Failed to commit the pid to location {0}, please verify'
|
||||
' that the location is available').format(pidfile)
|
||||
log.error(err)
|
||||
|
||||
|
||||
def daemonize():
|
||||
'''
|
||||
Daemonize a process
|
||||
|
Loading…
Reference in New Issue
Block a user