Improve error handling when remote check fails
This commit is contained in:
		
							parent
							
								
									602848cd9d
								
							
						
					
					
						commit
						dec2561db2
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -108,7 +108,11 @@ if __name__ == '__main__':
 | 
			
		|||
 | 
			
		||||
    # Ok now connect, and try to get values for memory
 | 
			
		||||
    client = schecks.connect(hostname, port, ssh_key_file, passphrase, user)
 | 
			
		||||
    result, exitcode = execute_check(client, check_path)
 | 
			
		||||
 | 
			
		||||
    print result
 | 
			
		||||
    sys.exit(exitcode)
 | 
			
		||||
    result = execute_check(client, check_path)
 | 
			
		||||
    if result is False:
 | 
			
		||||
        print("failed to execute remote check!")
 | 
			
		||||
        sys.exit(3)
 | 
			
		||||
    else:
 | 
			
		||||
        output, exitcode = result
 | 
			
		||||
        print(output)
 | 
			
		||||
        sys.exit(exitcode)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue