mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 11:52:01 +00:00
scripts: Replace optparse with argparse.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import optparse
|
import argparse
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -23,14 +23,14 @@ if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']:
|
|||||||
|
|
||||||
usage = """Usage: check-rabbitmq-consumers --queue=[queue-name] --min-threshold=[min-threshold]"""
|
usage = """Usage: check-rabbitmq-consumers --queue=[queue-name] --min-threshold=[min-threshold]"""
|
||||||
|
|
||||||
parser = optparse.OptionParser(usage=usage)
|
parser = argparse.ArgumentParser(usage=usage)
|
||||||
parser.add_option('--min-threshold',
|
parser.add_argument('--min-threshold',
|
||||||
dest='min_count',
|
dest='min_count',
|
||||||
type="int",
|
type=int,
|
||||||
default=1,
|
default=1,
|
||||||
action='store')
|
action='store')
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
output = subprocess.check_output(['/usr/sbin/rabbitmqctl', 'list_consumers'],
|
output = subprocess.check_output(['/usr/sbin/rabbitmqctl', 'list_consumers'],
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user