mirror of
				https://github.com/Rudd-O/ansible-qubes.git
				synced 2025-11-04 05:28:54 +01:00 
			
		
		
		
	Nicely ellipsize logged commands.
This commit is contained in:
		
							parent
							
								
									782c557cb6
								
							
						
					
					
						commit
						c85b35867d
					
				@ -3,7 +3,7 @@
 | 
				
			|||||||
%define mybuildnumber %{?build_number}%{?!build_number:1}
 | 
					%define mybuildnumber %{?build_number}%{?!build_number:1}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Name:           ansible-qubes
 | 
					Name:           ansible-qubes
 | 
				
			||||||
Version:        0.0.17
 | 
					Version:        0.0.18
 | 
				
			||||||
Release:        %{mybuildnumber}%{?dist}
 | 
					Release:        %{mybuildnumber}%{?dist}
 | 
				
			||||||
Summary:        Inter-VM program execution for Qubes OS AppVMs and StandaloneVMs
 | 
					Summary:        Inter-VM program execution for Qubes OS AppVMs and StandaloneVMs
 | 
				
			||||||
BuildArch:      noarch
 | 
					BuildArch:      noarch
 | 
				
			||||||
 | 
				
			|||||||
@ -321,12 +321,18 @@ def quotedargs():
 | 
				
			|||||||
    return " ".join(quote(x) for x in sys.argv[1:])
 | 
					    return " ".join(quote(x) for x in sys.argv[1:])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def quotedargs_ellipsized(cmdlist):
 | 
				
			||||||
 | 
					    text = " ".join(quote(x for x in sys.argv[1:]))
 | 
				
			||||||
 | 
					    if len(text) > 80:
 | 
				
			||||||
 | 
					        text = text[:77] + "..."
 | 
				
			||||||
 | 
					    return text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main_master():
 | 
					def main_master():
 | 
				
			||||||
    set_proc_name("bombshell-client (master) %s" % quotedargs())
 | 
					    set_proc_name("bombshell-client (master) %s" % quotedargs())
 | 
				
			||||||
    global logging
 | 
					    global logging
 | 
				
			||||||
    logging = LoggingEmu("master")
 | 
					    logging = LoggingEmu("master")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logging.info("Started with arguments: %s", sys.argv[1:])
 | 
					    logging.info("Started with arguments: %s", quotedargs_ellipsized(sys.argv[1:]))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    global debug_enabled
 | 
					    global debug_enabled
 | 
				
			||||||
    args = sys.argv[1:]
 | 
					    args = sys.argv[1:]
 | 
				
			||||||
@ -419,7 +425,7 @@ def main_remote():
 | 
				
			|||||||
    global logging
 | 
					    global logging
 | 
				
			||||||
    logging = LoggingEmu("remote")
 | 
					    logging = LoggingEmu("remote")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logging.info("Started with arguments: %s", sys.argv[1:])
 | 
					    logging.info("Started with arguments: %s", quotedargs_ellipsized(sys.argv[1:]))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    global debug_enabled
 | 
					    global debug_enabled
 | 
				
			||||||
    if "-d" in sys.argv[1:]:
 | 
					    if "-d" in sys.argv[1:]:
 | 
				
			||||||
@ -468,10 +474,11 @@ def main_remote():
 | 
				
			|||||||
    muxer.name = "remote multiplexer"
 | 
					    muxer.name = "remote multiplexer"
 | 
				
			||||||
    muxer.start()
 | 
					    muxer.start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logging.info("Started %s", nicecmd)
 | 
					    nicecmd_ellipsized = quotedargs_ellipsized(cmd)
 | 
				
			||||||
 | 
					    logging.info("Started %s", nicecmd_ellipsized)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    retval = p.wait()
 | 
					    retval = p.wait()
 | 
				
			||||||
    logging.info("Return code %s for %s", retval, nicecmd)
 | 
					    logging.info("Return code %s for %s", retval, nicecmd_ellipsized)
 | 
				
			||||||
    muxer.join()
 | 
					    muxer.join()
 | 
				
			||||||
    logging.info("Ending bombshell")
 | 
					    logging.info("Ending bombshell")
 | 
				
			||||||
    return retval
 | 
					    return retval
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user