Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to add more options to the SSH and SCP commands #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oEscal
Copy link

@oEscal oEscal commented Mar 2, 2022

When using this library to create Juju charms used in my OSM's VNFs, I felt the need to use other options for the SSH connection. For instance, I couldn't do so, if I had to use the SSH client option ServerAliveInterval, because there is not an argument on the run or ssh functions of the SSHProxy class to pass these SSH client options.

Therefore, the modifications I introduced now allow a developer to add these options that might be useful/needed in some specific cases. For example, if I now have the following code:

from osm.sshproxy import SSHProxy

ssh_proxy = SSHProxy('controller', 'ubuntu')
ssh_proxy.run('sudo apt install', ssh_options=['ServerAliveInterval=5', 'ConnectionAttempts=1'])

The corresponding ssh function will produce the command, with this set of wanted options:

['sshpass', '-p', '', 'ssh', '-i', '/var/lib/juju/agents/.ssh/id_sshproxy', '-o', 'StrictHostKeyChecking=no', '-o', 'ServerAliveInterval=5','-o', 'ConnectionAttempts=1', '-q', 'ubuntu@controller', 'sudo', 'apt', 'install']

Note: I also added this possibility to the scp function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants