def setup_transport(self):
    config = salt.utils.yaml.safe_load(subprocess.check_output(['bundle', 'exec', 'kitchen', 'diagnose', self.instance]))
    state = config['instances'][self.instance]['state_file']
    tport = config['instances'][self.instance]['transport']
    transport = paramiko.Transport((state['hostname'], state.get('port', tport.get('port', 22))))
    pkey = paramiko.rsakey.RSAKey(filename=state.get('ssh_key', tport.get('ssh_key', '~/.ssh/id_rsa')))
    transport.connect(username=state.get('username', tport.get('username', 'root')), pkey=pkey)
    return transport
def setup_transport(self):
    config = salt.utils.yaml.safe_load(subprocess.check_output(['bundle', 'exec', 'kitchen', 'diagnose', self.instance]))
    state = config['instances'][self.instance]['state_file']
    tport = config['instances'][self.instance]['transport']
    transport = paramiko.Transport((state['hostname'], state.get('port', tport.get('port', 22))))
    pkey = paramiko.rsakey.RSAKey(filename=state.get('ssh_key', tport.get('ssh_key', '~/.ssh/id_rsa')))
    transport.connect(username=state.get('username', tport.get('username', 'root')), pkey=pkey)
    return transport