Hey all,
I can't understand why the design was to create the public "run_command" method in BaseSSHClient class and public "execute" command in the SSHClient class. This methods are very similar and the use of them is confusing. In addition each of them hold very good features that you can't use in the other one:
run_command - sudo, user, read_timeout and HostOutput class as a return value.
execute - let you use an existing channel without opening a new one each time.
I can't fully understand why "execute" isn't a "private" method in the sub-class while the user can only use run_command with additional feature of providing a channel to use.
This leads to the "wait_finished" method who is implemented in SSHClient sub-class which expects HostOutput as a parameter to work which means the intention is to use "run_command" method.
I think "run_command" method should be the main API for sending commands while each sub-class can implement the "execute" private method, and "wait_finished" method should be in the super class for better OO design.
Needless to say this is just my opinion and what I am saying is just a suggestion.
Hey all, I can't understand why the design was to create the public "run_command" method in BaseSSHClient class and public "execute" command in the SSHClient class. This methods are very similar and the use of them is confusing. In addition each of them hold very good features that you can't use in the other one:
I can't fully understand why "execute" isn't a "private" method in the sub-class while the user can only use run_command with additional feature of providing a channel to use. This leads to the "wait_finished" method who is implemented in SSHClient sub-class which expects HostOutput as a parameter to work which means the intention is to use "run_command" method.
I think "run_command" method should be the main API for sending commands while each sub-class can implement the "execute" private method, and "wait_finished" method should be in the super class for better OO design.
Needless to say this is just my opinion and what I am saying is just a suggestion.
Thanks.