@@ -486,6 +486,13 @@ def _make_output_readers(self, channel, stdout_buffer, stderr_buffer):
486486 raise NotImplementedError
487487
488488 def execute (self , cmd , use_pty = False , channel = None ):
489+ """
490+ Deprecated - use ``run_command`` instead which returns a ``HostOutput`` object.
491+ """
492+ warn ("Deprecated - use run_command instead." , DeprecationWarning )
493+ return self ._execute (cmd , use_pty = use_pty , channel = channel )
494+
495+ def _execute (self , cmd , use_pty = False , channel = None ):
489496 raise NotImplementedError
490497
491498 def read_stderr (self , stderr_buffer , timeout = None ):
@@ -620,7 +627,7 @@ def run_command(self, command, sudo=False, user=None,
620627 _command += "%s '%s'" % (_shell , command ,)
621628 _command = _command .encode (encoding )
622629 with GTimeout (seconds = self .timeout ):
623- channel = self .execute (_command , use_pty = use_pty )
630+ channel = self ._execute (_command , use_pty = use_pty )
624631 _timeout = read_timeout if read_timeout else timeout
625632 host_out = self ._make_host_output (channel , encoding , _timeout )
626633 return host_out
0 commit comments