SAAS-560: Deploy separate cloud storage config files for each development environment
Renamed the analyzer config variables to be named specially for rabbitmq config
This commit is contained in:
parent
e6171680ad
commit
6cfac054ca
|
@ -23,7 +23,7 @@ class AirtimeAnalyzerServer:
|
|||
# Variables
|
||||
_log_level = logging.INFO
|
||||
|
||||
def __init__(self, config_path, cloud_storage_config_path, http_retry_queue_path, debug=False):
|
||||
def __init__(self, rmq_config_path, cloud_storage_config_path, http_retry_queue_path, debug=False):
|
||||
|
||||
# Dump a stacktrace with 'kill -SIGUSR2 <PID>'
|
||||
signal.signal(signal.SIGUSR2, lambda sig, frame: AirtimeAnalyzerServer.dump_stacktrace())
|
||||
|
@ -32,7 +32,7 @@ class AirtimeAnalyzerServer:
|
|||
self.setup_logging(debug)
|
||||
|
||||
# Read our rmq config file
|
||||
config = config_file.read_config_file(config_path)
|
||||
rmq_config = config_file.read_config_file(rmq_config_path)
|
||||
|
||||
# Read the cloud storage config file
|
||||
cloud_storage_config = config_file.read_config_file(cloud_storage_config_path)
|
||||
|
@ -42,7 +42,7 @@ class AirtimeAnalyzerServer:
|
|||
|
||||
# Start listening for RabbitMQ messages telling us about newly
|
||||
# uploaded files. This blocks until we recieve a shutdown signal.
|
||||
self._msg_listener = MessageListener(config, cloud_storage_config)
|
||||
self._msg_listener = MessageListener(rmq_config, cloud_storage_config)
|
||||
|
||||
StatusReporter.stop_thread()
|
||||
|
||||
|
|
|
@ -55,25 +55,25 @@ QUEUE = "airtime-uploads"
|
|||
"""
|
||||
class MessageListener:
|
||||
|
||||
def __init__(self, config, cloud_storage_config):
|
||||
def __init__(self, rmq_config, cloud_storage_config):
|
||||
''' Start listening for file upload notification messages
|
||||
from RabbitMQ
|
||||
|
||||
Keyword arguments:
|
||||
config: A ConfigParser object containing the [rabbitmq] configuration.
|
||||
rmq_config: A ConfigParser object containing the [rabbitmq] configuration.
|
||||
cloud_storage_config: A ConfigParser object containing the cloud storage configuration.
|
||||
'''
|
||||
|
||||
self._shutdown = False
|
||||
|
||||
# Read the RabbitMQ connection settings from the config file
|
||||
# Read the RabbitMQ connection settings from the rmq_config file
|
||||
# The exceptions throw here by default give good error messages.
|
||||
RMQ_CONFIG_SECTION = "rabbitmq"
|
||||
self._host = config.get(RMQ_CONFIG_SECTION, 'host')
|
||||
self._port = config.getint(RMQ_CONFIG_SECTION, 'port')
|
||||
self._username = config.get(RMQ_CONFIG_SECTION, 'user')
|
||||
self._password = config.get(RMQ_CONFIG_SECTION, 'password')
|
||||
self._vhost = config.get(RMQ_CONFIG_SECTION, 'vhost')
|
||||
self._host = rmq_config.get(RMQ_CONFIG_SECTION, 'host')
|
||||
self._port = rmq_config.getint(RMQ_CONFIG_SECTION, 'port')
|
||||
self._username = rmq_config.get(RMQ_CONFIG_SECTION, 'user')
|
||||
self._password = rmq_config.get(RMQ_CONFIG_SECTION, 'password')
|
||||
self._vhost = rmq_config.get(RMQ_CONFIG_SECTION, 'vhost')
|
||||
|
||||
self.cloud_storage_config = cloud_storage_config
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import os
|
|||
import airtime_analyzer.airtime_analyzer as aa
|
||||
|
||||
VERSION = "1.0"
|
||||
DEFAULT_CONFIG_PATH = '/etc/airtime/airtime.conf'
|
||||
DEFAULT_RMQ_CONFIG_PATH = '/etc/airtime/airtime.conf'
|
||||
DEFAULT_CLOUD_STORAGE_CONFIG_PATH = '/etc/airtime-saas/production/cloud_storage.conf'
|
||||
DEFAULT_HTTP_RETRY_PATH = '/tmp/airtime_analyzer_http_retries'
|
||||
|
||||
|
@ -18,7 +18,7 @@ def run():
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-d", "--daemon", help="run as a daemon", action="store_true")
|
||||
parser.add_argument("--debug", help="log full debugging output", action="store_true")
|
||||
parser.add_argument("--rmq-config-file", help="specify a configuration file with RabbitMQ settings (default is %s)" % DEFAULT_CONFIG_PATH)
|
||||
parser.add_argument("--rmq-config-file", help="specify a configuration file with RabbitMQ settings (default is %s)" % DEFAULT_RMQ_CONFIG_PATH)
|
||||
parser.add_argument("--cloud-storage-config-file", help="specify a configuration file with cloud storage settings (default is %s)" % DEFAULT_CLOUD_STORAGE_CONFIG_PATH)
|
||||
parser.add_argument("--http-retry-queue-file", help="specify where incompleted HTTP requests will be serialized (default is %s)" % DEFAULT_HTTP_RETRY_PATH)
|
||||
args = parser.parse_args()
|
||||
|
@ -26,11 +26,11 @@ def run():
|
|||
check_if_media_monitor_is_running()
|
||||
|
||||
#Default config file path
|
||||
config_path = DEFAULT_CONFIG_PATH
|
||||
rmq_config_path = DEFAULT_RMQ_CONFIG_PATH
|
||||
cloud_storage_config_path = DEFAULT_CLOUD_STORAGE_CONFIG_PATH
|
||||
http_retry_queue_path = DEFAULT_HTTP_RETRY_PATH
|
||||
if args.rmq_config_file:
|
||||
config_path = args.rmq_config_file
|
||||
rmq_config_path = args.rmq_config_file
|
||||
if args.cloud_storage_config_file:
|
||||
cloud_storage_config_path = args.cloud_storage_config_file
|
||||
if args.http_retry_queue_file:
|
||||
|
@ -38,13 +38,13 @@ def run():
|
|||
|
||||
if args.daemon:
|
||||
with daemon.DaemonContext():
|
||||
aa.AirtimeAnalyzerServer(config_path=config_path,
|
||||
aa.AirtimeAnalyzerServer(rmq_config_path=rmq_config_path,
|
||||
cloud_storage_config_path = cloud_storage_config_path,
|
||||
http_retry_queue_path=http_retry_queue_path,
|
||||
debug=args.debug)
|
||||
else:
|
||||
# Run without daemonizing
|
||||
aa.AirtimeAnalyzerServer(config_path=config_path,
|
||||
aa.AirtimeAnalyzerServer(rmq_config_path=rmq_config_path,
|
||||
cloud_storage_config_path = cloud_storage_config_path,
|
||||
http_retry_queue_path=http_retry_queue_path,
|
||||
debug=args.debug)
|
||||
|
|
Loading…
Reference in New Issue