
    tnik                     ,    d Z ddlZddlZddlmZ d ZdS )z"
Runpod | CLI | Utils | Userspace
    N)SSH_KEY_PATHc           	      l   t          j                    }|                    t          j                               t	          j        t                    D ]}t          j                            t          |          }t          j        	                    |          r|
                    d          r\	 |                    | |d|           |                                 t          d|  d| d|            |c S # t          $ r}t          d| d|            Y d	}~d	}~ww xY wt          d
           d	S )a  Find the SSH key file that can be used to connect to the pod.

    - Try all the keys in the SSH_KEY_PATH directory
    - If none of the keys work, return None
    - If multiple keys work, return the first one that works
    - Returns the path to the key file
    z.pubroot)portusernamekey_filenamezConnected to pod :z using key zAn error occurred with key z: Nz+Failed to connect using all available keys.)paramiko	SSHClientset_missing_host_key_policyAutoAddPolicyoslistdirr   pathjoinisfileendswithconnectcloseprint	Exception)pod_ippod_portsshfile	file_patherrs         Z/var/www/html/gpu-tools/venv/lib/python3.11/site-packages/runpod/cli/utils/rp_userspace.pyfind_ssh_key_filer      sK    


C##H$:$<$<===
<(( ? ?GLLt44	w~~i(( 	DMM&,A,A 		?KKXYKWWWIIKKKJfJJxJJDJJKKK 	? 	? 	?=====>>>>>>>>	? 

78884s   0AC99
D"DD")__doc__r   r
   runpodr   r        r   <module>r$      sN     
			           r#   