Update JSON serialization for "category"
authorMichele Tartara <mtartara@google.com>
Thu, 28 Mar 2013 09:14:46 +0000 (09:14 +0000)
committerMichele Tartara <mtartara@google.com>
Tue, 30 Apr 2013 07:55:37 +0000 (09:55 +0200)
Change the JSON serialization for the "category" field of data collectors,
in accordance to the latest version of the design document.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

src/Ganeti/DataCollectors/Types.hs

index 8a119ab..0626363 100644 (file)
@@ -36,6 +36,7 @@ module Ganeti.DataCollectors.Types
   , buildReport
   ) where
 
+import Data.Char
 import Text.JSON
 
 import Ganeti.Constants as C
@@ -48,7 +49,7 @@ data DCCategory = DCInstance | DCStorage | DCDaemon | DCHypervisor
 
 -- | The JSON instance for DCCategory.
 instance JSON DCCategory where
-  showJSON = showJSON . show
+  showJSON = showJSON . map toLower . drop 2 . show
   readJSON =
     error "JSON read instance not implemented for type DCCategory"