mirror of https://github.com/zulip/zulip.git
Remove legacy check_output implementation for pre-2.7 Pythons.
We still need it in integrations, because those don't require Python 2.7, but we don't need it in any of our code that runs on internal servers. (imported from commit 3c340567f1a372dcb4206c6af9a6e5e18005b1b8)
This commit is contained in:
parent
bd25224948
commit
442ae115a2
|
@ -5,9 +5,7 @@ import time
|
||||||
import optparse
|
import optparse
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
from zulip_tools import check_output
|
|
||||||
|
|
||||||
states = {
|
states = {
|
||||||
0: "OK",
|
0: "OK",
|
||||||
|
@ -35,7 +33,7 @@ parser.add_option('--min-threshold',
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
output = check_output(['/usr/sbin/rabbitmqctl', 'list_consumers'], shell=False)
|
output = subprocess.check_output(['/usr/sbin/rabbitmqctl', 'list_consumers'], shell=False)
|
||||||
|
|
||||||
consumers = defaultdict(int)
|
consumers = defaultdict(int)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,7 @@ import sys
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
from zulip_tools import check_output
|
|
||||||
|
|
||||||
WARN_THRESHOLD = 50
|
WARN_THRESHOLD = 50
|
||||||
CRIT_THRESHOLD = 100
|
CRIT_THRESHOLD = 100
|
||||||
|
@ -19,7 +17,7 @@ states = {
|
||||||
}
|
}
|
||||||
|
|
||||||
re = re.compile(r'(\w+)\t(\d+)')
|
re = re.compile(r'(\w+)\t(\d+)')
|
||||||
output = check_output(['/usr/sbin/rabbitmqctl', 'list_queues'], shell=False)
|
output = subprocess.check_output(['/usr/sbin/rabbitmqctl', 'list_queues'], shell=False)
|
||||||
|
|
||||||
status = 0
|
status = 0
|
||||||
max_count = 0
|
max_count = 0
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
from zulip_tools import check_output
|
|
||||||
|
|
||||||
class Record:
|
class Record:
|
||||||
pass
|
pass
|
||||||
|
@ -81,7 +79,7 @@ def validate(fn):
|
||||||
|
|
||||||
assert state.depth == 0
|
assert state.depth == 0
|
||||||
|
|
||||||
git_files = map(str.strip, check_output(['git', 'ls-files']).split('\n'))
|
git_files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n'))
|
||||||
|
|
||||||
# Check all our handlebars templates.
|
# Check all our handlebars templates.
|
||||||
templates = [fn for fn in git_files if fn.endswith('.handlebars')]
|
templates = [fn for fn in git_files if fn.endswith('.handlebars')]
|
||||||
|
|
|
@ -8,9 +8,6 @@ import subprocess
|
||||||
from os import path
|
from os import path
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
|
||||||
from zulip_tools import check_output
|
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('--full',
|
parser.add_option('--full',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
@ -40,7 +37,7 @@ api/setup.py
|
||||||
|
|
||||||
# Categorize by language all files known to Git
|
# Categorize by language all files known to Git
|
||||||
|
|
||||||
git_files = map(str.strip, check_output(['git', 'ls-files']).split('\n'))
|
git_files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n'))
|
||||||
by_lang = defaultdict(list)
|
by_lang = defaultdict(list)
|
||||||
|
|
||||||
for filepath in git_files:
|
for filepath in git_files:
|
||||||
|
|
|
@ -32,7 +32,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
from zulip_tools import check_output, ENDC, FAIL
|
from zulip_tools import ENDC, FAIL
|
||||||
|
|
||||||
def update_deployment(server, refname):
|
def update_deployment(server, refname):
|
||||||
return subprocess.call(["ssh", "-l", "zulip", server, "--", "env", "-u", "GIT_DIR",
|
return subprocess.call(["ssh", "-l", "zulip", server, "--", "env", "-u", "GIT_DIR",
|
||||||
|
@ -69,7 +69,7 @@ for ln in sys.stdin:
|
||||||
# 0000000000000000000000000000000000000000 means we're deleting the ref
|
# 0000000000000000000000000000000000000000 means we're deleting the ref
|
||||||
commits = ''
|
commits = ''
|
||||||
else:
|
else:
|
||||||
commits = check_output(["git", "log", "%s..%s" % (oldrev, newrev)])
|
commits = subprocess.check_output(["git", "log", "%s..%s" % (oldrev, newrev)])
|
||||||
|
|
||||||
if '[schema]' in commits:
|
if '[schema]' in commits:
|
||||||
print
|
print
|
||||||
|
|
|
@ -1,21 +1,6 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# check_output is backported from subprocess.py in Python 2.7
|
|
||||||
|
|
||||||
def check_output(*popenargs, **kwargs):
|
|
||||||
if 'stdout' in kwargs:
|
|
||||||
raise ValueError('stdout argument not allowed, it will be overridden.')
|
|
||||||
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
|
|
||||||
output, unused_err = process.communicate()
|
|
||||||
retcode = process.poll()
|
|
||||||
if retcode:
|
|
||||||
cmd = kwargs.get("args")
|
|
||||||
if cmd is None:
|
|
||||||
cmd = popenargs[0]
|
|
||||||
raise subprocess.CalledProcessError(retcode, cmd, output=output)
|
|
||||||
return output
|
|
||||||
|
|
||||||
DEPLOYMENTS_DIR = "/home/zulip/deployments"
|
DEPLOYMENTS_DIR = "/home/zulip/deployments"
|
||||||
LOCK_DIR = os.path.join(DEPLOYMENTS_DIR, "lock")
|
LOCK_DIR = os.path.join(DEPLOYMENTS_DIR, "lock")
|
||||||
TIMESTAMP_FORMAT = '%Y-%m-%d-%H-%M-%S'
|
TIMESTAMP_FORMAT = '%Y-%m-%d-%H-%M-%S'
|
||||||
|
|
Loading…
Reference in New Issue