On Tue, Sep 25, 2012 at 06:43:51PM +0200, Agata Murawska wrote:
> Simple conversion for queries that use live fields gathered from
> RPC calls.
> 
> Signed-off-by: Agata Murawska <[email protected]>
> ---
>  htools/Ganeti/Query/Common.hs |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/htools/Ganeti/Query/Common.hs b/htools/Ganeti/Query/Common.hs
> index ea70fc9..a57d5f6 100644
> --- a/htools/Ganeti/Query/Common.hs
> +++ b/htools/Ganeti/Query/Common.hs
> @@ -29,6 +29,7 @@ module Ganeti.Query.Common
>    , rsMaybe
>    , rsUnknown
>    , missingRuntime
> +  , rpcErrorToStatus
>    , timeStampFields
>    , uuidFields
>    , serialFields
> @@ -45,6 +46,7 @@ import Text.JSON (JSON, showJSON)
>  import qualified Ganeti.Constants as C
>  import Ganeti.Config
>  import Ganeti.Objects
> +import Ganeti.Rpc
>  import Ganeti.Query.Language
>  import Ganeti.Query.Types
>  
> @@ -84,6 +86,14 @@ rsUnknown = ResultEntry RSUnknown Nothing
>  missingRuntime :: FieldGetter a b
>  missingRuntime = FieldRuntime (\_ _ -> ResultEntry RSNoData Nothing)
>  
> +-- * Error conversion
> +
> +-- | Convert RpcError to ResultStatus
> +rpcErrorToStatus :: RpcError -> ResultStatus
> +rpcErrorToStatus CurlDisabledError = RSUnknown

This can't be RSUnkown. The RPC layer can't return this value, but
rather RSNoData.

iustin

Reply via email to