Yay for making that a proper type!

LGTM, thanks

On Fri, 13 Nov 2015 at 11:17 'Hrvoje Ribicic' via ganeti-devel <
[email protected]> wrote:

> This will allow us to perform validation of opcode params that are SSH
> key types.
>
> Signed-off-by: Hrvoje Ribicic <[email protected]>
> ---
>  src/Ganeti/Constants.hs |  6 +++---
>  src/Ganeti/Types.hs     | 11 +++++++++++
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> index d20a8da..eedd493 100644
> --- a/src/Ganeti/Constants.hs
> +++ b/src/Ganeti/Constants.hs
> @@ -4680,13 +4680,13 @@ cryptoOptionSerialNo = "serial_no"
>  -- * SSH key types
>
>  sshkDsa :: String
> -sshkDsa = "dsa"
> +sshkDsa = Types.sshKeyTypeToRaw DSA
>
>  sshkEcdsa :: String
> -sshkEcdsa = "ecdsa"
> +sshkEcdsa = Types.sshKeyTypeToRaw ECDSA
>
>  sshkRsa :: String
> -sshkRsa = "rsa"
> +sshkRsa = Types.sshKeyTypeToRaw RSA
>
>  sshkAll :: FrozenSet String
>  sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa, sshkEcdsa]
> diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs
> index f311827..9823189 100644
> --- a/src/Ganeti/Types.hs
> +++ b/src/Ganeti/Types.hs
> @@ -172,6 +172,8 @@ module Ganeti.Types
>    , hotplugTargetToRaw
>    , HotplugAction(..)
>    , hotplugActionToRaw
> +  , SshKeyType(..)
> +  , sshKeyTypeToRaw
>    , Private(..)
>    , showPrivateJSObject
>    , Secret(..)
> @@ -952,6 +954,15 @@ $(THH.declareLADT ''String "HotplugTarget"
>    ])
>  $(THH.makeJSONInstance ''HotplugTarget)
>
> +-- | SSH key type.
> +
> +$(THH.declareLADT ''String "SshKeyType"
> +  [ ("RSA", "rsa")
> +  , ("DSA", "dsa")
> +  , ("ECDSA", "ecdsa")
> +  ])
> +$(THH.makeJSONInstance ''SshKeyType)
> +
>  -- * Private type and instances
>
>  redacted :: String
> --
> 2.6.0.rc2.230.g3dd15c0
>
> --

Helga Velroyen
Software Engineer
[email protected]

Google Germany GmbH
Dienerstraße 12
80331 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und
löschen Sie die E-Mail und alle Anhänge. Vielen Dank.

This e-mail is confidential. If you are not the right addressee please do
not forward it, please inform the sender, and please erase this e-mail
including any attachments. Thanks.

Reply via email to