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 <[email protected]>
---
 lib/cli_opts.py           | 13 +++++++++++++
 lib/client/gnt_cluster.py |  4 ++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/cli_opts.py b/lib/cli_opts.py
index c04d306..d82ebcb 100644
--- a/lib/cli_opts.py
+++ b/lib/cli_opts.py
@@ -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]
 
diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index d84306b..dd31092 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -2405,7 +2405,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"),
@@ -2505,7 +2505,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": (
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to