mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
scripts/zulip_tools: Use run_as_root instead of subprocess.check_call.
This commit is contained in:
committed by
Tim Abbott
parent
ac48925977
commit
3d427d02cc
@@ -148,9 +148,9 @@ def get_dev_uuid_var_path(create_if_missing=False):
|
|||||||
else:
|
else:
|
||||||
if create_if_missing:
|
if create_if_missing:
|
||||||
zulip_uuid = str(uuid.uuid4())
|
zulip_uuid = str(uuid.uuid4())
|
||||||
# We need sudo here, since the path will be under /srv/ in the
|
# We need root access here, since the path will be under /srv/ in the
|
||||||
# development environment.
|
# development environment.
|
||||||
subprocess.check_call(["sudo", "/bin/bash", "-c",
|
run_as_root(["/bin/bash", "-c",
|
||||||
"echo %s > %s" % (zulip_uuid, uuid_path)])
|
"echo %s > %s" % (zulip_uuid, uuid_path)])
|
||||||
else:
|
else:
|
||||||
raise AssertionError("Missing UUID file; please run tools/provision!")
|
raise AssertionError("Missing UUID file; please run tools/provision!")
|
||||||
@@ -332,7 +332,7 @@ def may_be_perform_purging(dirs_to_purge, dirs_to_keep, dir_type, dry_run, verbo
|
|||||||
if verbose:
|
if verbose:
|
||||||
print("Cleaning unused %s: %s" % (dir_type, directory))
|
print("Cleaning unused %s: %s" % (dir_type, directory))
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
subprocess.check_call(["sudo", "rm", "-rf", directory])
|
run_as_root(["rm", "-rf", directory])
|
||||||
|
|
||||||
for directory in dirs_to_keep:
|
for directory in dirs_to_keep:
|
||||||
if verbose:
|
if verbose:
|
||||||
|
|||||||
@@ -480,9 +480,6 @@ def build_custom_checkers(by_lang):
|
|||||||
'include_only': set(['scripts/']),
|
'include_only': set(['scripts/']),
|
||||||
'exclude': set(['scripts/lib/setup_venv.py']),
|
'exclude': set(['scripts/lib/setup_venv.py']),
|
||||||
'exclude_line': set([
|
'exclude_line': set([
|
||||||
('scripts/lib/zulip_tools.py', '# We need sudo here, since the path will be under /srv/ in the'),
|
|
||||||
('scripts/lib/zulip_tools.py', 'subprocess.check_call(["sudo", "/bin/bash", "-c",'),
|
|
||||||
('scripts/lib/zulip_tools.py', 'subprocess.check_call(["sudo", "rm", "-rf", directory])'),
|
|
||||||
('scripts/lib/zulip_tools.py', 'sudo_args = kwargs.pop(\'sudo_args\', [])'),
|
('scripts/lib/zulip_tools.py', 'sudo_args = kwargs.pop(\'sudo_args\', [])'),
|
||||||
('scripts/lib/zulip_tools.py', 'args = [\'sudo\'] + sudo_args + [\'--\'] + args'),
|
('scripts/lib/zulip_tools.py', 'args = [\'sudo\'] + sudo_args + [\'--\'] + args'),
|
||||||
]),
|
]),
|
||||||
|
|||||||
Reference in New Issue
Block a user