From 070a903fa838d2a75959dbb60f2beb94134dbef5 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Sun, 19 Jul 2020 23:23:46 +0200 Subject: [PATCH] Allow Syslog's address to be set from an environment variable. - Also rename ``RFM_GRAYLOG_SERVER`` to ``RFM_GRAYLOG_ADDRESS`` for symmetry. --- docs/manpage.rst | 28 +++++++++++++++++++++++++++- reframe/frontend/cli.py | 14 +++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/manpage.rst b/docs/manpage.rst index 85e3621ec5..520a6b9599 100644 --- a/docs/manpage.rst +++ b/docs/manpage.rst @@ -637,7 +637,7 @@ Here is an alphabetical list of the environment variables recognized by ReFrame: ================================== ================== -.. envvar:: RFM_GRAYLOG_SERVER +.. envvar:: RFM_GRAYLOG_ADDRESS The address of the Graylog server to send performance logs. The address is specified in ``host:port`` format. @@ -651,6 +651,15 @@ Here is an alphabetical list of the environment variables recognized by ReFrame: ================================== ================== +.. versionadded:: 3.1 + + +.. envvar:: RFM_GRAYLOG_SERVER + + .. deprecated:: 3.1 + Please :envvar:`RFM_GRAYLOG_ADDRESS` instead. + + .. envvar:: RFM_IGNORE_CHECK_CONFLICTS Ignore tests with conflicting names when loading. @@ -807,6 +816,23 @@ Here is an alphabetical list of the environment variables recognized by ReFrame: ================================== ================== +.. envvar:: RFM_SYSLOG_ADDRESS + + The address of the Syslog server to send performance logs. + The address is specified in ``host:port`` format. + If no port is specified, the address refers to a UNIX socket. + + .. table:: + :align: left + + ================================== ================== + Associated command line option N/A + Associated configuration parameter :js:attr:`address` syslog log handler configuration parameter + ================================== ================== + + +.. versionadded:: 3.1 + .. envvar:: RFM_SYSTEM Set the current system. diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index f650fd70e7..97771a6a04 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -347,10 +347,16 @@ def main(): # Options not associated with command-line arguments argparser.add_argument( dest='graylog_server', - envvar='RFM_GRAYLOG_SERVER', + envvar='RFM_GRAYLOG_ADDRESS', configvar='logging/handlers_perflog/graylog_address', help='Graylog server address' ) + argparser.add_argument( + dest='syslog_address', + envvar='RFM_SYSLOG_ADDRESS', + configvar='logging/handlers_perflog/syslog_address', + help='Syslog server address' + ) argparser.add_argument( dest='ignore_reqnodenotavail', envvar='RFM_IGNORE_REQNODENOTAVAIL', @@ -386,6 +392,12 @@ def main(): printer = PrettyPrinter() printer.colorize = site_config.get('general/0/colorize') printer.inc_verbosity(site_config.get('general/0/verbose')) + if os.getenv('RFM_GRAYLOG_SERVER'): + printer.warning( + 'RFM_GRAYLOG_SERVER environment variable is deprecated; ' + 'please use RFM_GRAYLOG_ADDRESS instead' + ) + os.environ['RFM_GRAYLOG_ADDRESS'] = os.getenv('RFM_GRAYLOG_SERVER') if options.upgrade_config_file is not None: old_config, *new_config = options.upgrade_config_file.split(