title: Python - Capture exit status of command executed via SSH
body: <p>I need a way to capture exit status from a command run through SSH.  Would like the exit status to end up within a variable.  I cannot seem to get it working though.</p>
  
  <p>Command would be something simple like:</p>
  
  <p>os.system("ssh -qt hostname 'sudo yum list updates --security > /tmp/yum_update_packagelist.txt';echo $?")</p>
  
  <p>Anyone have an idea?  Everything I've tried has either not worked at all, or ended up giving me the exit status of the ssh command, not the underlying command.</p>