Module prepare_node_join
source code
Script to prepare a node for joining a cluster.
|
|
|
VerifyOptions(parser,
opts,
args)
Verifies options and arguments for correctness. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dict
|
LoadData(raw)
Parses and verifies input data. |
source code
|
|
|
|
|
_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,
OpenSSL,
cli,
constants,
errors,
pathutils,
utils,
serializer,
ht,
ssh,
ssconf
Parses the options passed to the program.
- Returns:
- Options and arguments
|
_VerifyCertificate(cert_pem,
_check_fn=utils.CheckNodeCertificate)
| source code
|
Verifies a certificate against the local node daemon certificate.
- Parameters:
cert_pem (string) - Certificate in PEM format (no key)
|
VerifyCertificate(data,
_verify_fn=_VerifyCertificate)
| source code
|
Verifies cluster certificate.
- Parameters:
|
VerifyClusterName(data,
_verify_fn=ssconf.VerifyClusterName)
| source code
|
Verifies cluster name.
- Parameters:
|
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
|
_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,})
|
|