Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1import subprocess 

2 

3# Check a OCI api call response 

4def check_response(r, error_factory=None): 

5 if r.status != 200: 

6 if error_factory is None: 

7 error = Exception("request failed") 

8 else: 

9 error = error_factory() 

10 raise error 

11 

12def remote_execute(host, cmd, error_ok=False): 

13 r = subprocess.call(["ssh", "-q", "-t", host, cmd], shell=False) 

14 if not error_ok and r != 0: 

15 raise Exception(f"command \"{cmd}\" failed with exit code {r}") 

16