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
|
salt minions. The file server is a stateless ZeroMQ server that is built into
|
||||||
the salt master.
|
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
|
Salt state system. With this said, the Salt file server can be used for any
|
||||||
general file transfer from the master to the minions.
|
general file transfer from the master to the minions.
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ class Master(object):
|
|||||||
# command line overrides config
|
# command line overrides config
|
||||||
if self.cli['user']:
|
if self.cli['user']:
|
||||||
self.opts['user'] = self.cli['user']
|
self.opts['user'] = self.cli['user']
|
||||||
|
|
||||||
# Send the pidfile location to the opts
|
# Send the pidfile location to the opts
|
||||||
if self.cli['pidfile']:
|
if self.cli['pidfile']:
|
||||||
self.opts['pidfile'] = self.cli['pidfile']
|
self.opts['pidfile'] = self.cli['pidfile']
|
||||||
@ -97,7 +98,6 @@ class Master(object):
|
|||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
# Late import so logging works correctly
|
# Late import so logging works correctly
|
||||||
if check_user(self.opts['user'], log):
|
|
||||||
import salt.master
|
import salt.master
|
||||||
master = salt.master.Master(self.opts)
|
master = salt.master.Master(self.opts)
|
||||||
if self.cli['daemon']:
|
if self.cli['daemon']:
|
||||||
@ -105,6 +105,7 @@ class Master(object):
|
|||||||
import salt.utils
|
import salt.utils
|
||||||
salt.utils.daemonize()
|
salt.utils.daemonize()
|
||||||
set_pidfile(self.opts['pidfile'])
|
set_pidfile(self.opts['pidfile'])
|
||||||
|
if check_user(self.opts['user'], log):
|
||||||
try:
|
try:
|
||||||
master.start()
|
master.start()
|
||||||
except salt.master.MasterExit:
|
except salt.master.MasterExit:
|
||||||
@ -186,13 +187,13 @@ class Minion(object):
|
|||||||
# Late import so logging works correctly
|
# Late import so logging works correctly
|
||||||
import salt.minion
|
import salt.minion
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
if check_user(self.opts['user'], log):
|
|
||||||
try:
|
|
||||||
if self.cli['daemon']:
|
if self.cli['daemon']:
|
||||||
# Late import so logging works correctly
|
# Late import so logging works correctly
|
||||||
import salt.utils
|
import salt.utils
|
||||||
salt.utils.daemonize()
|
salt.utils.daemonize()
|
||||||
set_pidfile(self.cli['pidfile'])
|
set_pidfile(self.cli['pidfile'])
|
||||||
|
if check_user(self.opts['user'], log):
|
||||||
|
try:
|
||||||
minion = salt.minion.Minion(self.opts)
|
minion = salt.minion.Minion(self.opts)
|
||||||
minion.tune_in()
|
minion.tune_in()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
@ -303,14 +304,14 @@ class Syndic(object):
|
|||||||
# Late import so logging works correctly
|
# Late import so logging works correctly
|
||||||
import salt.minion
|
import salt.minion
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
if check_user(self.opts['user'], log):
|
|
||||||
try:
|
|
||||||
syndic = salt.minion.Syndic(self.opts)
|
|
||||||
if self.cli['daemon']:
|
if self.cli['daemon']:
|
||||||
# Late import so logging works correctly
|
# Late import so logging works correctly
|
||||||
import salt.utils
|
import salt.utils
|
||||||
salt.utils.daemonize()
|
salt.utils.daemonize()
|
||||||
set_pidfile(self.cli['pidfile'])
|
set_pidfile(self.cli['pidfile'])
|
||||||
|
if check_user(self.opts['user'], log):
|
||||||
|
try:
|
||||||
|
syndic = salt.minion.Syndic(self.opts)
|
||||||
syndic.tune_in()
|
syndic.tune_in()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
log.warn('Stopping the Salt Syndic Minion')
|
log.warn('Stopping the Salt Syndic Minion')
|
||||||
|
@ -131,7 +131,6 @@ class Master(SMaster):
|
|||||||
'''
|
'''
|
||||||
Clean out the old jobs
|
Clean out the old jobs
|
||||||
'''
|
'''
|
||||||
salt.utils.append_pid(self.opts['pidfile'])
|
|
||||||
while True:
|
while True:
|
||||||
cur = "{0:%Y%m%d%H}".format(datetime.datetime.now())
|
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
|
Bind to the interface specified in the configuration file
|
||||||
'''
|
'''
|
||||||
salt.utils.append_pid(self.opts['pidfile'])
|
|
||||||
context = zmq.Context(1)
|
context = zmq.Context(1)
|
||||||
pub_sock = context.socket(zmq.PUB)
|
pub_sock = context.socket(zmq.PUB)
|
||||||
pull_sock = context.socket(zmq.PULL)
|
pull_sock = context.socket(zmq.PULL)
|
||||||
@ -286,7 +284,6 @@ class ReqServer(object):
|
|||||||
'''
|
'''
|
||||||
Start up the ReqServer
|
Start up the ReqServer
|
||||||
'''
|
'''
|
||||||
salt.utils.append_pid(self.opts['pidfile'])
|
|
||||||
self.__bind()
|
self.__bind()
|
||||||
|
|
||||||
|
|
||||||
@ -376,7 +373,6 @@ class MWorker(multiprocessing.Process):
|
|||||||
'''
|
'''
|
||||||
Start a Master Worker
|
Start a Master Worker
|
||||||
'''
|
'''
|
||||||
salt.utils.append_pid(self.opts['pidfile'])
|
|
||||||
self.__bind()
|
self.__bind()
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,18 +81,6 @@ def get_colors(use=True):
|
|||||||
return colors
|
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():
|
def daemonize():
|
||||||
'''
|
'''
|
||||||
Daemonize a process
|
Daemonize a process
|
||||||
|
Loading…
Reference in New Issue
Block a user