packages feed

language-puppet 1.1.1 → 1.1.1.1

raw patch · 2 files changed

+10/−6 lines, 2 filesdep ~either

Dependency ranges changed: either

Files

language-puppet.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                language-puppet-version:             1.1.1+version:             1.1.1.1 synopsis:            Tools to parse and evaluate the Puppet DSL. description:         This is a set of tools that is supposed to fill all your Puppet needs : syntax checks, catalog compilation, PuppetDB queries, simulationg of complex interactions between nodes, Puppet master replacement, and more ! homepage:            http://lpuppet.banquise.net/@@ -150,7 +150,7 @@   type:           exitcode-stdio-1.0   ghc-options:    -Wall -rtsopts -threaded   extensions:     OverloadedStrings-  build-depends:  language-puppet,base,temporary,strict-base-types,lens,text+  build-depends:  language-puppet,base,temporary,strict-base-types,lens,text,either   main-is:        puppetdb.hs Test-Suite erbparser   hs-source-dirs: tests
tests/puppetdb.hs view
@@ -7,6 +7,7 @@ import qualified Data.Text as T import qualified Data.Text.IO as T import Control.Lens+import Control.Monad.Trans.Either  import Puppet.Interpreter.Types import PuppetDB.Common@@ -17,6 +18,9 @@ checkError _ (S.Right x) = return x checkError step (S.Left rr) = error (step ++ ": " ++ show rr) +checkErrorE :: Show x => String -> EitherT x IO a -> IO a+checkErrorE msg = runEitherT >=> either (error . ((msg ++ " ") ++) . show) return+ main :: IO () main = withSystemTempDirectory "hieratest" $ \tmpfp -> do     let ndname = "node.site.com"@@ -28,8 +32,8 @@     -- and add a custom fact     let nfacts = facts & at "customfact" ?~ "MyCustomFactValue"     -- save the facts-    replaceFacts pdb [(ndname, nfacts)] >>= checkError "replaceFacts"-    commitDB pdb >>= checkError "commitDB"+    checkErrorE "replaceFacts" (replaceFacts pdb [(ndname, nfacts)])+    checkErrorE "commitDB" (commitDB pdb)     -- check that our custom fact was indeed saved     dblines <- T.lines `fmap` T.readFile pdbfile     unless ("    customfact: MyCustomFactValue" `elem` dblines) (error "could not find my fact")@@ -37,8 +41,8 @@     fpdb <- loadTestDB pdbfile >>= checkError "loadTestDB"     ffacts <- puppetDBFacts ndname pdb     unless (ffacts == nfacts) (error "facts are distinct")-    replaceCatalog fpdb (generateWireCatalog ndname mempty mempty) >>= checkError "replaceCatalog"-    commitDB fpdb >>= checkError "commit 2"+    checkErrorE "replaceCatalog" (replaceCatalog fpdb (generateWireCatalog ndname mempty mempty))+    checkErrorE "commit 2" (commitDB fpdb)     -- and check for our facts again     fdblines <- T.lines `fmap` T.readFile pdbfile     unless ("    customfact: MyCustomFactValue" `elem` fdblines) (error "could not find my fact")