Package ganeti :: Module ssh
[hide private]
[frames] | no frames]

Module ssh

source code

Module encapsulating ssh functionality.

Classes [hide private]
  SshRunner
Wrapper for SSH commands.
Functions [hide private]
 
FormatParamikoFingerprint(fingerprint)
Format paramiko PKey fingerprint.
source code
 
GetUserFiles(user, mkdir=False)
Return the paths of a user's ssh files.
source code
 
WriteKnownHostsFile(cfg, file_name)
Writes the cluster-wide equally known_hosts file.
source code

Imports: os, logging, re, utils, errors, constants, netutils


Function Details [hide private]

FormatParamikoFingerprint(fingerprint)

source code 

Format paramiko PKey fingerprint.

Parameters:
  • fingerprint (str) - PKey fingerprint
Returns:
The string hex representation of the fingerprint

GetUserFiles(user, mkdir=False)

source code 

Return the paths of a user's ssh files.

The function will return a triplet (priv_key_path, pub_key_path, auth_key_path) that are used for ssh authentication. Currently, the keys used are DSA keys, so this function will return: (~user/.ssh/id_dsa, ~user/.ssh/id_dsa.pub, ~user/.ssh/authorized_keys).

If the optional parameter mkdir is True, the ssh directory will be created if it doesn't exist.

Regardless of the mkdir parameters, the script will raise an error if ~user/.ssh is not a directory.