Add the SSH key options
authorHrvoje Ribicic <riba@google.com>
Fri, 9 Oct 2015 20:57:38 +0000 (20:57 +0000)
committerHrvoje Ribicic <riba@google.com>
Fri, 20 Nov 2015 10:13:50 +0000 (11:13 +0100)
The two options added in this patch are ssh-key-bits and
ssh-key-type, which will control the length and type of key later.
They are added to the gnt-cluster init and renew-crypto submethods.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/cli_opts.py
lib/client/gnt_cluster.py

index ae58ede..9f4d530 100644 (file)
@@ -238,6 +238,8 @@ __all__ = [
   "SPLIT_ISPECS_OPTS",
   "SRC_DIR_OPT",
   "SRC_NODE_OPT",
+  "SSH_KEY_BITS_OPT",
+  "SSH_KEY_TYPE_OPT",
   "STARTUP_PAUSED_OPT",
   "STATIC_OPT",
   "SUBMIT_OPT",
@@ -1594,6 +1596,17 @@ LONG_SLEEP_OPT = cli_option(
     "--long-sleep", default=False, dest="long_sleep",
     help="Allow long shutdowns when backing up instances", action="store_true")
 
+SSH_KEY_TYPE_OPT = \
+    cli_option("--ssh-key-type", default=None,
+               choices=list(constants.SSHK_ALL), dest="ssh_key_type",
+               help="Type of SSH key deployed by Ganeti for cluster actions")
+
+SSH_KEY_BITS_OPT = \
+    cli_option("--ssh-key-bits", default=None,
+               type="int", dest="ssh_key_bits",
+               help="Length of SSH keys generated by Ganeti, in bits")
+
+
 #: Options provided by all commands
 COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
 
index e65057d..2ade408 100644 (file)
@@ -2406,7 +2406,7 @@ commands = {
      HV_STATE_OPT, DISK_STATE_OPT, ENABLED_DISK_TEMPLATES_OPT,
      IPOLICY_STD_SPECS_OPT, GLOBAL_GLUSTER_FILEDIR_OPT, INSTALL_IMAGE_OPT,
      ZEROING_IMAGE_OPT, COMPRESSION_TOOLS_OPT,
-     ENABLED_USER_SHUTDOWN_OPT,
+     ENABLED_USER_SHUTDOWN_OPT, SSH_KEY_BITS_OPT, SSH_KEY_TYPE_OPT,
      ]
      + INSTANCE_POLICY_OPTS + SPLIT_ISPECS_OPTS,
     "[opts...] <cluster_name>", "Initialises a new cluster configuration"),
@@ -2506,7 +2506,7 @@ commands = {
      NEW_CLUSTER_DOMAIN_SECRET_OPT, CLUSTER_DOMAIN_SECRET_OPT,
      NEW_SPICE_CERT_OPT, SPICE_CERT_OPT, SPICE_CACERT_OPT,
      NEW_NODE_CERT_OPT, NEW_SSH_KEY_OPT, NOSSH_KEYCHECK_OPT,
-     VERBOSE_OPT],
+     VERBOSE_OPT, SSH_KEY_BITS_OPT, SSH_KEY_TYPE_OPT],
     "[opts...]",
     "Renews cluster certificates, keys and secrets"),
   "epo": (