diff options
Diffstat (limited to 'src/mailman/commands')
| -rw-r--r-- | src/mailman/commands/cli_control.py | 6 | ||||
| -rw-r--r-- | src/mailman/commands/cli_info.py | 17 | ||||
| -rw-r--r-- | src/mailman/commands/docs/control.txt | 2 | ||||
| -rw-r--r-- | src/mailman/commands/docs/info.txt | 43 | ||||
| -rw-r--r-- | src/mailman/commands/docs/unshunt.txt | 2 |
5 files changed, 65 insertions, 5 deletions
diff --git a/src/mailman/commands/cli_control.py b/src/mailman/commands/cli_control.py index bd108ecd3..e6c9c83b3 100644 --- a/src/mailman/commands/cli_control.py +++ b/src/mailman/commands/cli_control.py @@ -127,11 +127,11 @@ class Start: def kill_watcher(sig): try: - with open(config.PIDFILE) as fp: + with open(config.PID_FILE) as fp: pid = int(fp.read().strip()) except (IOError, ValueError) as error: # For i18n convenience - print >> sys.stderr, _('PID unreadable in: $config.PIDFILE') + print >> sys.stderr, _('PID unreadable in: $config.PID_FILE') print >> sys.stderr, error print >> sys.stderr, _('Is the master even running?') return @@ -143,7 +143,7 @@ def kill_watcher(sig): print >> sys.stderr, _('No child with pid: $pid') print >> sys.stderr, error print >> sys.stderr, _('Stale pid file removed.') - os.unlink(config.PIDFILE) + os.unlink(config.PID_FILE) diff --git a/src/mailman/commands/cli_info.py b/src/mailman/commands/cli_info.py index b3ca02718..98a025673 100644 --- a/src/mailman/commands/cli_info.py +++ b/src/mailman/commands/cli_info.py @@ -50,6 +50,11 @@ class Info: action='store', help=_("""\ File to send the output to. If not given, standard output is used.""")) + command_parser.add_argument( + '-p', '--paths', + action='store_true', help=_("""\ + A more verbose output including the file system paths that Mailman + is using.""")) def process(self, args): """See `ICLISubCommand`.""" @@ -59,8 +64,18 @@ class Info: # We don't need to close output because that will happen # automatically when the script exits. output = open(args.output, 'w') - print >> output, MAILMAN_VERSION_FULL print >> output, 'Python', sys.version print >> output, 'config file:', config.filename print >> output, 'db url:', config.db.url + if args.paths: + print >> output, 'File system paths:' + longest = 0 + paths = {} + for attribute in dir(config): + if attribute.endswith('_DIR') or attribute.endswith('_FILE'): + paths[attribute] = getattr(config, attribute) + longest = max(longest, len(attribute)) + for attribute in sorted(paths): + print ' {0:{2}} = {1}'.format(attribute, paths[attribute], + longest) diff --git a/src/mailman/commands/docs/control.txt b/src/mailman/commands/docs/control.txt index 7bfaf9265..78a15b7b2 100644 --- a/src/mailman/commands/docs/control.txt +++ b/src/mailman/commands/docs/control.txt @@ -72,7 +72,7 @@ watcher process in the background. ... while datetime.now() < until: ... time.sleep(0.1) ... try: - ... with open(config.PIDFILE) as fp: + ... with open(config.PID_FILE) as fp: ... pid = int(fp.read().strip()) ... os.kill(pid, 0) ... except IOError as error: diff --git a/src/mailman/commands/docs/info.txt b/src/mailman/commands/docs/info.txt index f524d8f0a..53a1d531d 100644 --- a/src/mailman/commands/docs/info.txt +++ b/src/mailman/commands/docs/info.txt @@ -10,6 +10,7 @@ script 'mailman info'. By default, the info is printed to standard output. >>> class FakeArgs: ... output = None + ... paths = None >>> args = FakeArgs() >>> command.process(args) @@ -33,3 +34,45 @@ By passing in the -o/--output option, you can print the info to a file. ... config file: .../test.cfg db url: sqlite:.../mailman.db + +You can also get more verbose information, which contains a list of the file +system paths that Mailman is using. + + >>> args.output = None + >>> args.paths = True + >>> config.create_paths = False + >>> config.push('fhs', """ + ... [mailman] + ... layout: fhs + ... """) + >>> config.create_paths = True + +The File System Hierarchy layout is the same every by definition. + + >>> command.process(args) + GNU Mailman 3... + Python ... + ... + File system paths: + BIN_DIR = /sbin + CREATOR_PW_FILE = /var/lib/mailman/data/creator.pw + DATA_DIR = /var/lib/mailman/data + ETC_DIR = /etc + EXT_DIR = /etc/mailman.d + LIST_DATA_DIR = /var/lib/mailman/lists + LOCK_DIR = /var/lock/mailman + LOCK_FILE = /var/lock/mailman/master-qrunner.lck + LOG_DIR = /var/log/mailman + MESSAGES_DIR = /var/lib/mailman/messages + PID_FILE = /var/run/mailman/master-qrunner.pid + PRIVATE_ARCHIVE_FILE_DIR = /var/lib/mailman/archives/private + PUBLIC_ARCHIVE_FILE_DIR = /var/lib/mailman/archives/public + QUEUE_DIR = /var/spool/mailman + SITE_PW_FILE = /var/lib/mailman/data/adm.pw + VAR_DIR = /var/lib/mailman + + +Clean up +======== + + >>> config.pop('fhs') diff --git a/src/mailman/commands/docs/unshunt.txt b/src/mailman/commands/docs/unshunt.txt index 2c2ed5712..dcf71f3d1 100644 --- a/src/mailman/commands/docs/unshunt.txt +++ b/src/mailman/commands/docs/unshunt.txt @@ -23,6 +23,8 @@ Let's say there is a message in the shunt queue. ... """) >>> shuntq = config.switchboards['shunt'] + >>> len(list(shuntq.files)) + 0 >>> base_name = shuntq.enqueue(msg, {}) >>> len(list(shuntq.files)) 1 |
