LGTM, thanks.
On Mon, Oct 7, 2013 at 4:37 PM, Jose A. Lopes <[email protected]> wrote: > Add constant 'osApiVersions' to the Haskell to Python constant > generation. This patch fixes the type of this constant, by changing > from 'List' to 'Set', therefore, 'Ganeti.Query.Server' is updated > accordingly. > > Signed-off-by: Jose A. Lopes <[email protected]> > --- > lib/constants.py | 12 ++++-------- > src/Ganeti/HsConstants.hs | 12 ++++++++++++ > src/Ganeti/Query/Server.hs | 6 +++++- > 3 files changed, 21 insertions(+), 9 deletions(-) > > diff --git a/lib/constants.py b/lib/constants.py > index fc8b99c..f154f5f 100644 > --- a/lib/constants.py > +++ b/lib/constants.py > @@ -32,14 +32,10 @@ from ganeti import pathutils > > # various versions > RELEASE_VERSION = _constants.RELEASE_VERSION > -OS_API_V10 = 10 > -OS_API_V15 = 15 > -OS_API_V20 = 20 > -OS_API_VERSIONS = compat.UniqueFrozenset([ > - OS_API_V10, > - OS_API_V15, > - OS_API_V20, > - ]) > +OS_API_V10 = _constants.OS_API_V10 > +OS_API_V15 = _constants.OS_API_V15 > +OS_API_V20 = _constants.OS_API_V20 > +OS_API_VERSIONS = _constants.OS_API_VERSIONS > VCS_VERSION = _vcsversion.VCS_VERSION > EXPORT_VERSION = 0 > RAPI_VERSION = 2 > diff --git a/src/Ganeti/HsConstants.hs b/src/Ganeti/HsConstants.hs > index a4f4ab7..a6424a6 100644 > --- a/src/Ganeti/HsConstants.hs > +++ b/src/Ganeti/HsConstants.hs > @@ -139,6 +139,18 @@ versionRevision = AutoConf.versionRevision > dirVersion :: String > dirVersion = AutoConf.dirVersion > > +osApiV10 :: Int > +osApiV10 = 10 > + > +osApiV15 :: Int > +osApiV15 = 15 > + > +osApiV20 :: Int > +osApiV20 = 20 > + > +osApiVersions :: FrozenSet Int > +osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20] > + > configMajor :: Int > configMajor = AutoConf.versionMajor > > diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs > index db5356f..e28c6aa 100644 > --- a/src/Ganeti/Query/Server.hs > +++ b/src/Ganeti/Query/Server.hs > @@ -36,6 +36,7 @@ import Control.Concurrent > import Control.Exception > import Control.Monad (forever) > import Data.Bits (bitSize) > +import qualified Data.Set as Set (toList) > import Data.IORef > import qualified Network.Socket as S > import qualified Text.JSON as J > @@ -43,6 +44,7 @@ import Text.JSON (showJSON, JSValue(..)) > import System.Info (arch) > > import qualified Ganeti.Constants as C > +import qualified Ganeti.ConstantUtils as ConstantUtils (unFrozenSet) > import Ganeti.Errors > import qualified Ganeti.Path as Path > import Ganeti.Daemon > @@ -96,7 +98,9 @@ handleCall cdata QueryClusterInfo = > obj = [ ("software_version", showJSON C.releaseVersion) > , ("protocol_version", showJSON C.protocolVersion) > , ("config_version", showJSON C.configVersion) > - , ("os_api_version", showJSON $ maximum C.osApiVersions) > + , ("os_api_version", showJSON . maximum . > + Set.toList . ConstantUtils.unFrozenSet $ > + C.osApiVersions) > , ("export_version", showJSON C.exportVersion) > , ("vcs_version", showJSON C.vcsVersion) > , ("architecture", showJSON arch_tuple) > -- > 1.8.4 > > -- Thomas Thrainer | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
