rpmserver: Accept logging directory as argument in scripts.
We currently hard code the absolute path of the log file generated by
these scripts in rpm_config.ini
This is not maintainable in the lab, because there is no sane way to
override rpm_config.ini on the servers.
Instead, accept the logging directory via commandline.
BUG=chromium:762233
TEST=(1) unittests
(2) Run rpmserver daemons via upstart.
Change-Id: I5485ae1a25536783b8f5a84d205f0b74bd5de4bc
Reviewed-on: https://chromium-review.googlesource.com/669946
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/site_utils/rpm_control_system/frontend_server.py b/site_utils/rpm_control_system/frontend_server.py
index 6ec33d4..bd162fc 100755
--- a/site_utils/rpm_control_system/frontend_server.py
+++ b/site_utils/rpm_control_system/frontend_server.py
@@ -360,10 +360,12 @@
Main function used to launch the frontend server. Creates an instance of
RPMFrontendServer and registers it to a MultiThreadedXMLRPCServer instance.
"""
- if len(sys.argv) > 1:
- print 'Usage: ./%s, no arguments available.' % sys.argv[0]
+ if len(sys.argv) != 2:
+ print 'Usage: ./%s <log_file_dir>.' % sys.argv[0]
sys.exit(1)
- email_handler = rpm_logging_config.set_up_logging(LOG_FILENAME_FORMAT)
+
+ email_handler = rpm_logging_config.set_up_logging_to_file(
+ sys.argv[1], LOG_FILENAME_FORMAT)
frontend_server = RPMFrontendServer(email_handler=email_handler)
address = rpm_config.get('RPM_INFRASTRUCTURE', 'frontend_addr')
port = rpm_config.getint('RPM_INFRASTRUCTURE', 'frontend_port')