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

Module prepare_node_join

source code

Script to prepare a node for joining a cluster.

Classes [hide private]
  JoinError
Local class for reporting errors.
Functions [hide private]
 
ParseOptions()
Parses the options passed to the program.
source code
 
_UpdateKeyFiles(keys, dry_run, keyfiles)
Updates SSH key files.
source code
 
UpdateSshDaemon(data, dry_run, _runcmd_fn=utils.RunCmd, _keyfiles=None)
Updates SSH daemon's keys.
source code
 
UpdateSshRoot(data, dry_run, _homedir_fn=None)
Updates root's SSH keys.
source code
 
Main()
Main routine.
source code
Variables [hide private]
  _SSH_KEY_LIST_ITEM = ht.TAnd(ht.TIsLength(3), ht.TItems([ht.TE...
  _SSH_KEY_LIST = ht.TListOf(_SSH_KEY_LIST_ITEM)
  _DATA_CHECK = ht.TStrictDict(False, True, {constants.SSHS_CLUS...

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


Function Details [hide private]

ParseOptions()

source code 

Parses the options passed to the program.

Returns:
Options and arguments

_UpdateKeyFiles(keys, dry_run, keyfiles)

source code 

Updates SSH key files.

Parameters:
  • keys (sequence of tuple; (string, string, string)) - Keys to write, tuples consist of key type (constants.SSHK_ALL), public and private key
  • dry_run (boolean) - Whether to perform a dry run
  • keyfiles (dict; (string as key, tuple with (string, string) as values)) - Mapping from key types (constants.SSHK_ALL) to file names; value tuples consist of public key filename and private key filename

UpdateSshDaemon(data, dry_run, _runcmd_fn=utils.RunCmd, _keyfiles=None)

source code 

Updates SSH daemon's keys.

Unless dry_run is set, the daemon is restarted at the end.

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

UpdateSshRoot(data, dry_run, _homedir_fn=None)

source code 

Updates root's SSH keys.

Root's authorized_keys file is also updated with new public keys.

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

Variables Details [hide private]

_SSH_KEY_LIST_ITEM

Value:
ht.TAnd(ht.TIsLength(3), ht.TItems([ht.TElemOf(constants.SSHK_ALL), ht\
.Comment("public")(ht.TNonEmptyString), ht.Comment("private")(ht.TNonE\
mptyString),]))

_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_HOST_KEY: _SSH_KEY_LIST, constants.SSHS_SSH_ROOT_KEY:\
 _SSH_KEY_LIST, constants.SSHS_SSH_AUTHORIZED_KEYS: ht.TDictOf(ht.TNon\
EmptyString, ht.TListOf(ht.TNonEmptyString)),})