mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +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,10 +148,10 @@ def get_dev_uuid_var_path(create_if_missing=False):
 | 
			
		||||
    else:
 | 
			
		||||
        if create_if_missing:
 | 
			
		||||
            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.
 | 
			
		||||
            subprocess.check_call(["sudo", "/bin/bash", "-c",
 | 
			
		||||
                                   "echo %s > %s" % (zulip_uuid, uuid_path)])
 | 
			
		||||
            run_as_root(["/bin/bash", "-c",
 | 
			
		||||
                         "echo %s > %s" % (zulip_uuid, uuid_path)])
 | 
			
		||||
        else:
 | 
			
		||||
            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:
 | 
			
		||||
            print("Cleaning unused %s: %s" % (dir_type, directory))
 | 
			
		||||
        if not dry_run:
 | 
			
		||||
            subprocess.check_call(["sudo", "rm", "-rf", directory])
 | 
			
		||||
            run_as_root(["rm", "-rf", directory])
 | 
			
		||||
 | 
			
		||||
    for directory in dirs_to_keep:
 | 
			
		||||
        if verbose:
 | 
			
		||||
 
 | 
			
		||||
@@ -480,9 +480,6 @@ def build_custom_checkers(by_lang):
 | 
			
		||||
         'include_only': set(['scripts/']),
 | 
			
		||||
         'exclude': set(['scripts/lib/setup_venv.py']),
 | 
			
		||||
         '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', 'args = [\'sudo\'] + sudo_args + [\'--\'] + args'),
 | 
			
		||||
         ]),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user