Script setup_ssh
[hide private]
[frames] | no frames]

Script setup_ssh

Tool to setup the SSH configuration on a remote node.

This is needed before we can join the node into the cluster.

Classes [hide private]
  RemoteCommandError
Exception if remote command was not successful.
Functions [hide private]
 
_RunRemoteCommand(transport, command)
Invokes and wait for the command over SSH.
 
_InvokeDaemonUtil(transport, command)
Invokes daemon-util on the remote side.
 
_WriteSftpFile(sftp, name, perm, data)
SFTPs data to a remote file.
 
SetupSSH(transport)
Sets the SSH up on the other side.
 
SetupNodeDaemon(transport)
Sets the node daemon up on the other side.
 
ParseOptions()
Parses options passed to program.
 
SetupLogging(options)
Sets up the logging.
list
LoadPrivateKeys(options)
Load the list of available private keys.
boolean
LoginViaKeys(transport, username, keys)
Try to login on the given transport via a list of keys.
 
LoadKnownHosts()
Load the known hosts.
 
main()
Main routine.

Imports: getpass, logging, paramiko, os, optparse, sys, cli, constants, errors, netutils, ssh, utils


Function Details [hide private]

_RunRemoteCommand(transport, command)

 

Invokes and wait for the command over SSH.

Parameters:
  • transport - The paramiko transport instance
  • command - The command to be executed

_InvokeDaemonUtil(transport, command)

 

Invokes daemon-util on the remote side.

Parameters:
  • transport - The paramiko transport instance
  • command - The daemon-util command to be run

_WriteSftpFile(sftp, name, perm, data)

 

SFTPs data to a remote file.

Parameters:
  • sftp - A open paramiko SFTP client
  • name - The remote file name
  • perm - The remote file permission
  • data - The data to write

SetupSSH(transport)

 

Sets the SSH up on the other side.

Parameters:
  • transport - The paramiko transport instance

SetupNodeDaemon(transport)

 

Sets the node daemon up on the other side.

Parameters:
  • transport - The paramiko transport instance

SetupLogging(options)

 

Sets up the logging.

Parameters:
  • options - Parsed options

LoadPrivateKeys(options)

 

Load the list of available private keys.

It loads the standard ssh key from disk and then tries to connect to the ssh agent too.

Returns: list
a list of paramiko.PKey

LoginViaKeys(transport, username, keys)

 

Try to login on the given transport via a list of keys.

Parameters:
  • transport - the transport to use
  • username - the username to login as
  • keys (list) - list of paramiko.PKey to use for authentication
Returns: boolean
True or False depending on whether the login was successfull or not

LoadKnownHosts()

 

Load the known hosts.

Returns:
paramiko.util.load_host_keys dict