mirror of
				https://github.com/Rudd-O/ansible-qubes.git
				synced 2025-10-30 19:18:56 +01:00 
			
		
		
		
	Eliminate the lock.
This commit is contained in:
		
							parent
							
								
									3a60f0ee4b
								
							
						
					
					
						commit
						8675eaa547
					
				| @ -2,7 +2,6 @@ | ||||
| 
 | ||||
| import base64 | ||||
| import pickle | ||||
| import contextlib | ||||
| import errno | ||||
| import fcntl | ||||
| import os | ||||
| @ -43,18 +42,6 @@ def set_proc_name(newname): | ||||
|     libc.prctl(15, byref(buff), 0, 0, 0) | ||||
| 
 | ||||
| 
 | ||||
| @contextlib.contextmanager | ||||
| def mutexfile(filepath): | ||||
|     oldumask = os.umask(0o077) | ||||
|     try: | ||||
|         f = open(filepath, "a") | ||||
|     finally: | ||||
|         os.umask(oldumask) | ||||
|     fcntl.lockf(f.fileno(), fcntl.LOCK_EX) | ||||
|     yield | ||||
|     f.close() | ||||
| 
 | ||||
| 
 | ||||
| def unset_cloexec(fd): | ||||
|     old = fcntl.fcntl(fd, fcntl.F_GETFD) | ||||
|     fcntl.fcntl(fd, fcntl.F_SETFD, old & ~fcntl.FD_CLOEXEC) | ||||
| @ -370,28 +357,27 @@ def main_master(): | ||||
| 
 | ||||
|     saved_stderr = openfdforappend(os.dup(sys.stderr.fileno())) | ||||
| 
 | ||||
|     with mutexfile(os.path.expanduser("~/.bombshell-lock")): | ||||
|         try: | ||||
|             p = subprocess.Popen( | ||||
|                 ["qrexec-client-vm", remote_vm, "qubes.VMShell"], | ||||
|                 stdin=subprocess.PIPE, | ||||
|                 stdout=subprocess.PIPE, | ||||
|                 close_fds=True, | ||||
|                 preexec_fn=os.setpgrp, | ||||
|                 bufsize=0, | ||||
|             ) | ||||
|         except OSError as e: | ||||
|             logging.error("cannot launch qrexec-client-vm: %s", e) | ||||
|             return 127 | ||||
|     try: | ||||
|         p = subprocess.Popen( | ||||
|             ["qrexec-client-vm", remote_vm, "qubes.VMShell"], | ||||
|             stdin=subprocess.PIPE, | ||||
|             stdout=subprocess.PIPE, | ||||
|             close_fds=True, | ||||
|             preexec_fn=os.setpgrp, | ||||
|             bufsize=0, | ||||
|         ) | ||||
|     except OSError as e: | ||||
|         logging.error("cannot launch qrexec-client-vm: %s", e) | ||||
|         return 127 | ||||
| 
 | ||||
|         logging.debug("Writing the helper text into the other side") | ||||
|         p.stdin.write(remote_helper_text) | ||||
|         p.stdin.flush() | ||||
|     logging.debug("Writing the helper text into the other side") | ||||
|     p.stdin.write(remote_helper_text) | ||||
|     p.stdin.flush() | ||||
| 
 | ||||
|         confirmation, errmsg = recv_confirmation(p.stdout) | ||||
|         if confirmation != 0: | ||||
|             logging.error("remote: %s", errmsg) | ||||
|             return confirmation | ||||
|     confirmation, errmsg = recv_confirmation(p.stdout) | ||||
|     if confirmation != 0: | ||||
|         logging.error("remote: %s", errmsg) | ||||
|         return confirmation | ||||
| 
 | ||||
|     handled_signals = ( | ||||
|         signal.SIGINT, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Manuel Amador (Rudd-O)
						Manuel Amador (Rudd-O)