handled exception if the docker deamon does not expose events on the REST-API
This commit is contained in:
		
							parent
							
								
									312e91a940
								
							
						
					
					
						commit
						f7713d84a3
					
				| @ -1,6 +1,7 @@ | |||||||
| #!/usr/bin/python3.4 | #!/usr/bin/python3.4 | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
|  | import sys | ||||||
| import http.client | import http.client | ||||||
| import json | import json | ||||||
| import signal | import signal | ||||||
| @ -118,7 +119,12 @@ if not os.path.exists(target_path): | |||||||
| pid = get_pid() | pid = get_pid() | ||||||
| 
 | 
 | ||||||
| conn = http.client.HTTPConnection("localhost:2375") | conn = http.client.HTTPConnection("localhost:2375") | ||||||
|  | try: | ||||||
| 	conn.request("GET", "/events") | 	conn.request("GET", "/events") | ||||||
|  | except ConnectionRefusedError: | ||||||
|  | 	print('Docker does not expose events on its REST-API. Perhaps it is not running?') | ||||||
|  | 	sys.exit(-1) | ||||||
|  | 
 | ||||||
| response = conn.getresponse() | response = conn.getresponse() | ||||||
| 
 | 
 | ||||||
| events = "" | events = "" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Joachim Lusiardi
						Joachim Lusiardi