To allow various command-line operations like renew-crypto and node
adds to know how to generate SSH keys, some config values need to be
queried outside of LUs. This patch adds the ssh_key_type and
ssh_key_bits to the config values that can be queried.

Signed-off-by: Hrvoje Ribicic <[email protected]>
---
 src/Ganeti/Query/Server.hs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs
index 5d39110..480e780 100644
--- a/src/Ganeti/Query/Server.hs
+++ b/src/Ganeti/Query/Server.hs
@@ -374,13 +374,15 @@ handleCall _ _ cfg (QueryNetworks names fields lock) =
     (map Left names) fields lock
 
 handleCall _ _ cfg (QueryConfigValues fields) = do
-  let params = [ ("cluster_name", return . showJSON . clusterClusterName
-                                    . configCluster $ cfg)
+  let clusterProperty fn = showJSON . fn . configCluster $ cfg
+  let params = [ ("cluster_name", return $ clusterProperty clusterClusterName)
                , ("watcher_pause", liftM (maybe JSNull showJSON)
                                      QCluster.isWatcherPaused)
                , ("master_node", return . genericResult (const JSNull) showJSON
                                    $ QCluster.clusterMasterNodeName cfg)
                , ("drain_flag", liftM (showJSON . not) isQueueOpen)
+               , ("ssh_key_type", return $ clusterProperty clusterSshKeyType)
+               , ("ssh_key_bits", return $ clusterProperty clusterSshKeyBits)
                ] :: [(String, IO JSValue)]
   let answer = map (fromMaybe (return JSNull) . flip lookup params) fields
   answerEval <- sequence answer
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to