Skip to content

Commit

Permalink
Add warning for deprecated logging config file
Browse files Browse the repository at this point in the history
Add a warning, so that if the user provides a path for the logging
config file (or a file exists at the old delfault path), the user
is warned that the functionality has been deprecated.
  • Loading branch information
Letizia97 authored and tofu-rocketry committed Dec 12, 2022
1 parent 7549342 commit f149b8b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@ def main():
op = OptionParser(description=__doc__, version=ver)
op.add_option('-c', '--config', help='location of config file',
default='/etc/apel/receiver.cfg')
op.add_option('-l', '--log_config',
help='DEPRECATED - location of logging config file (optional)',
default=None)
op.add_option('-d', '--dn_file',
help='location of the file containing valid DNs',
default='/etc/apel/dns')

options, unused_args = op.parse_args()

# Absolute file path required when refreshing dn_file, relative path resulted in an error.
# Deprecating functionality.
old_log_config_default_path = '/etc/apel/logging.cfg'
if (os.path.exists(old_log_config_default_path) or options.log_config != None):
logging.warning('Separate logging config file option has been deprecated.')

# Absolute file path required when refreshing dn_file, relative path resulted in an error.
options.dn_file = os.path.abspath(options.dn_file)

cp = ConfigParser.ConfigParser({'use_ssl': 'true'})
Expand Down
9 changes: 9 additions & 0 deletions bin/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from ssm import __version__, LOG_BREAK

import logging
import os
from optparse import OptionParser

try:
Expand All @@ -36,9 +37,17 @@ def main():
op = OptionParser(description=__doc__, version=ver)
op.add_option('-c', '--config', help='location of config file',
default='/etc/apel/sender.cfg')
op.add_option('-l', '--log_config',
help='DEPRECATED - location of logging config file (optional)',
default=None)

options, unused_args = op.parse_args()

# Deprecating functionality.
old_log_config_default_path = '/etc/apel/logging.cfg'
if (os.path.exists(old_log_config_default_path) or options.log_config != None):
logging.warning('Separate logging config file option has been deprecated.')

cp = ConfigParser.ConfigParser({'use_ssl': 'true'})
cp.read(options.config)

Expand Down

0 comments on commit f149b8b

Please sign in to comment.