puppetresources 0.3.6 → 0.4.0
raw patch · 2 files changed
+10/−4 lines, 2 filesdep ~language-puppet
Dependency ranges changed: language-puppet
Files
- Main.hs +8/−2
- puppetresources.cabal +2/−2
Main.hs view
@@ -122,6 +122,12 @@ usage = error "Usage: puppetresource puppetdir nodename [filename]" +addRequire :: FinalCatalog -> ((ResIdentifier, ResIdentifier), LinkInfo) -> FinalCatalog+addRequire curcat ((src, dst), (ltype, _, _)) =+ case Map.lookup src curcat of+ Nothing -> curcat+ Just res -> Map.insert src (res { rrelations = (ltype, dst) : rrelations res }) curcat+ {-| Does all the work of initializing a daemon for querying. Returns the final catalog when given a node name. Note that this is pretty hackish as it will generate facts from the local computer !@@ -129,14 +135,14 @@ initializedaemonWithPuppet :: Maybe String -> String -> IO ([Char] -> IO FinalCatalog) initializedaemonWithPuppet purl puppetdir = do- LOG.updateGlobalLogger "Puppet.Daemon" (LOG.setLevel LOG.INFO)+ LOG.updateGlobalLogger "Puppet.Daemon" (LOG.setLevel LOG.WARNING) prefs <- genPrefs puppetdir (queryfunc, _, _, _) <- initDaemon (prefs { puppetDBurl = purl }) return (\nodename -> do o <- allFacts nodename >>= queryfunc nodename case o of Left err -> error err- Right x -> return x+ Right (c,m,_) -> return $ foldl' addRequire c (Map.toList m) ) {-| A helper for when you don't want to use PuppetDB -}
puppetresources.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: puppetresources-version: 0.3.6+version: 0.4.0 synopsis: A program that displays the puppet resources associated to a node given .pp files. -- description: license: GPL-3@@ -25,7 +25,7 @@ ghc-options: -rtsopts -- other-modules: build-depends: base >=3 && <5,- language-puppet >= 0.2.2.0,+ language-puppet >= 0.3.0.0, hsfacter >= 0.2.0.0, containers, hslogger,