Package ganeti :: Package tools :: Module ssh_update
[hide private]
[frames] | no frames]

Module ssh_update

source code

Script to update a node's SSH key files.

This script is used to update the node's 'authorized_keys' and 'ganeti_pub_key' files. It will be called via SSH from the master node.

Classes [hide private]
  SshUpdateError
Local class for reporting errors.
Functions [hide private]
 
ParseOptions()
Parses the options passed to the program.
source code
 
UpdateAuthorizedKeys(data, dry_run, _homedir_fn=None)
Updates root's authorized_keys file.
source code
 
UpdatePubKeyFile(data, dry_run, key_file=pathutils.SSH_PUB_KEYS)
Updates the file of public SSH keys.
source code
 
GenerateRootSshKeys(data, dry_run)
(Re-)generates the root SSH keys.
source code
 
Main()
Main routine.
source code
Variables [hide private]
  _DATA_CHECK = ht.TStrictDict(False, True, {constants.SSHS_CLUS...

Imports: os, optparse, sys, logging, cli, constants, errors, utils, ht, ssh, pathutils, common


Function Details [hide private]

ParseOptions()

source code 

Parses the options passed to the program.

Returns:
Options and arguments

UpdateAuthorizedKeys(data, dry_run, _homedir_fn=None)

source code 

Updates root's authorized_keys file.

Parameters:
  • data (dict) - Input data
  • dry_run (boolean) - Whether to perform a dry run

UpdatePubKeyFile(data, dry_run, key_file=pathutils.SSH_PUB_KEYS)

source code 

Updates the file of public SSH keys.

Parameters:
  • data (dict) - Input data
  • dry_run (boolean) - Whether to perform a dry run

GenerateRootSshKeys(data, dry_run)

source code 

(Re-)generates the root SSH keys.

Parameters:
  • data (dict) - Input data
  • dry_run (boolean) - Whether to perform a dry run

Variables Details [hide private]

_DATA_CHECK

Value:
ht.TStrictDict(False, True, {constants.SSHS_CLUSTER_NAME: ht.TNonEmpty\
String, constants.SSHS_NODE_DAEMON_CERTIFICATE: ht.TNonEmptyString, co\
nstants.SSHS_SSH_PUBLIC_KEYS: ht.TItems([ht.TElemOf(constants.SSHS_ACT\
IONS), ht.TDictOf(ht.TNonEmptyString, ht.TListOf(ht.TNonEmptyString))]\
), constants.SSHS_SSH_AUTHORIZED_KEYS: ht.TItems([ht.TElemOf(constants\
.SSHS_ACTIONS), ht.TDictOf(ht.TNonEmptyString, ht.TListOf(ht.TNonEmpty\
String))]), constants.SSHS_GENERATE: ht.TItems([ht.TSshKeyType, ht.TPo\
sitive, ht.TString]), constants.SSHS_SSH_KEY_TYPE: ht.TSshKeyType, con\
...