making the server starter fail if SWIFT_HASH_PATH_SUFFIX is not there
This commit is contained in:
parent
c99c976881
commit
3749d8c23a
|
@ -45,6 +45,7 @@ class Daemon(object):
|
|||
sys.stderr = utils.LoggerFileObject(self.logger)
|
||||
|
||||
utils.drop_privileges(self.conf.get('user', 'swift'))
|
||||
utils.validate_configuration()
|
||||
|
||||
try:
|
||||
os.setsid()
|
||||
|
|
|
@ -57,21 +57,24 @@ _posix_fadvise = None
|
|||
# paths. It simply appends this value to all paths; guessing the hash a path
|
||||
# will end up with would also require knowing this suffix.
|
||||
hash_conf = ConfigParser()
|
||||
HASH_PATH_SUFFIX = None
|
||||
HASH_PATH_SUFFIX = ''
|
||||
if hash_conf.read('/etc/swift/swift.conf'):
|
||||
try:
|
||||
HASH_PATH_SUFFIX = hash_conf.get('swift-hash',
|
||||
'swift_hash_path_suffix')
|
||||
except (NoSectionError, NoOptionError):
|
||||
pass
|
||||
if HASH_PATH_SUFFIX is None:
|
||||
sys.exit("Error: [swift-hash]: swift_hash_path_suffix missing "
|
||||
"from /etc/swift/swift.conf")
|
||||
|
||||
# Used when reading config values
|
||||
TRUE_VALUES = set(('true', '1', 'yes', 'True', 'Yes', 'on', 'On'))
|
||||
|
||||
|
||||
def validate_configuration():
|
||||
if HASH_PATH_SUFFIX == '':
|
||||
sys.exit("Error: [swift-hash]: swift_hash_path_suffix missing "
|
||||
"from /etc/swift/swift.conf")
|
||||
|
||||
|
||||
def load_libc_function(func_name):
|
||||
"""
|
||||
Attempt to find the function in libc, otherwise return a no-op func.
|
||||
|
|
|
@ -34,7 +34,7 @@ wsgi.ACCEPT_ERRNO.add(ECONNRESET)
|
|||
from eventlet.green import socket, ssl
|
||||
|
||||
from swift.common.utils import get_logger, drop_privileges, \
|
||||
LoggerFileObject, NullLogger
|
||||
validate_configuration, LoggerFileObject, NullLogger
|
||||
|
||||
|
||||
def monkey_patch_mimetools():
|
||||
|
@ -112,6 +112,7 @@ def run_wsgi(conf_file, app_section, *args, **kwargs): # pragma: no cover
|
|||
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600)
|
||||
worker_count = int(conf.get('workers', '1'))
|
||||
drop_privileges(conf.get('user', 'swift'))
|
||||
validate_configuration()
|
||||
|
||||
def run_server():
|
||||
wsgi.HttpProtocol.default_request_version = "HTTP/1.0"
|
||||
|
|
Loading…
Reference in New Issue