summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mailman/bin/master.py15
-rw-r--r--src/mailman/commands/cli_control.py9
2 files changed, 16 insertions, 8 deletions
diff --git a/src/mailman/bin/master.py b/src/mailman/bin/master.py
index 6dc2a451f..e7efdc537 100644
--- a/src/mailman/bin/master.py
+++ b/src/mailman/bin/master.py
@@ -353,7 +353,7 @@ class Loop:
# Set the environment variable which tells the runner that it's
# running under bin/master control. This subtly changes the error
# behavior of bin/runner.
- os.environ['MAILMAN_UNDER_MASTER_CONTROL'] = '1'
+ env = {'MAILMAN_UNDER_MASTER_CONTROL': '1'}
# Craft the command line arguments for the exec() call.
rswitch = '--runner=' + spec
# Wherever master lives, so too must live the runner script.
@@ -361,14 +361,21 @@ class Loop:
# config.PYTHON, which is the absolute path to the Python interpreter,
# must be given as argv[0] due to Python's library search algorithm.
args = [sys.executable, sys.executable, exe, rswitch]
- if self._config_file is not None:
- args.extend(['-C', self._config_file])
+ # Always pass the explicit path to the configuration file to the
+ # sub-runners. This avoids any debate about which cfg file is used.
+ config_file = (config.filename if self._config_file is None
+ else self._config_file)
+ args.extend(['-C', config_file])
log = logging.getLogger('mailman.runner')
log.debug('starting: %s', args)
+ # We must pass this environment variable through if it's set,
+ # otherwise runner processes will not have the correct VAR_DIR.
+ var_dir = os.environ.get('MAILMAN_VAR_DIR')
+ if var_dir is not None:
+ env['MAILMAN_VAR_DIR'] = var_dir
# For the testing framework, if this environment variable is set, pass
# it on to the subprocess.
coverage_env = os.environ.get('COVERAGE_PROCESS_START')
- env = dict()
if coverage_env is not None:
env['COVERAGE_PROCESS_START'] = coverage_env
args.append(env)
diff --git a/src/mailman/commands/cli_control.py b/src/mailman/commands/cli_control.py
index 2febe08e5..de3542106 100644
--- a/src/mailman/commands/cli_control.py
+++ b/src/mailman/commands/cli_control.py
@@ -120,8 +120,8 @@ class Start:
# subprocesses to calculate their path to the $VAR_DIR. Before we
# chdir() though, calculate the absolute path to the configuration
# file.
- config_path = (os.path.abspath(args.config)
- if args.config else None)
+ config_path = (config.filename if args.config is None
+ else os.path.abspath(args.config))
os.environ['MAILMAN_VAR_DIR'] = config.VAR_DIR
os.chdir(config.VAR_DIR)
# Exec the master watcher.
@@ -131,8 +131,9 @@ class Start:
]
if args.force:
execl_args.append('--force')
- if config_path:
- execl_args.extend(['-C', config_path])
+ # Always pass the config file path to the master projects, so there's
+ # no confusion about which cfg is being used.
+ execl_args.extend(['-C', config_path])
qlog.debug('starting: %s', execl_args)
os.execl(*execl_args)
# We should never get here.