Merge branch 'develop' of github.com:saltstack/salt into develop

This commit is contained in:
Thomas S Hatch 2012-03-14 12:36:16 -06:00
commit 1e625de5c1
4 changed files with 20 additions and 35 deletions

View File

@ -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.

View File

@ -29,7 +29,8 @@ class Master(object):
# command line overrides config
if 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']:
self.opts['pidfile'] = self.cli['pidfile']
@ -97,14 +98,14 @@ class Master(object):
import logging
log = logging.getLogger(__name__)
# Late import so logging works correctly
import salt.master
master = salt.master.Master(self.opts)
if self.cli['daemon']:
# Late import so logging works correctly
import salt.utils
salt.utils.daemonize()
set_pidfile(self.opts['pidfile'])
if check_user(self.opts['user'], log):
import salt.master
master = salt.master.Master(self.opts)
if self.cli['daemon']:
# Late import so logging works correctly
import salt.utils
salt.utils.daemonize()
set_pidfile(self.opts['pidfile'])
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 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:
if self.cli['daemon']:
# Late import so logging works correctly
import salt.utils
salt.utils.daemonize()
set_pidfile(self.cli['pidfile'])
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 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)
if self.cli['daemon']:
# Late import so logging works correctly
import salt.utils
salt.utils.daemonize()
set_pidfile(self.cli['pidfile'])
syndic.tune_in()
except KeyboardInterrupt:
log.warn('Stopping the Salt Syndic Minion')

View File

@ -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()

View File

@ -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