packages feed

puppetresources 0.1.1 → 0.1.2

raw patch · 2 files changed

+27/−12 lines, 2 filesdep ~hsfacterdep ~language-puppet

Dependency ranges changed: hsfacter, language-puppet

Files

Main.hs view
@@ -120,7 +120,7 @@         let ofacts = genFacts rawfacts             (hostname, ddomainname) = break (== '.') nodename             domainname = tail $ ddomainname-            nfacts = genFacts [("fqdn", nodename), ("hostname", hostname), ("domain", domainname)]+            nfacts = genFacts [("fqdn", nodename), ("hostname", hostname), ("domain", domainname), ("rootrsa", "xxx")]             allfacts = Map.union nfacts ofacts         o <- queryfunc nodename allfacts         case o of@@ -153,7 +153,6 @@                     then []                     else showpdiff rpname lpval rpval - getdiff :: ResIdentifier -> RResource -> RResource -> String getdiff (rtype,rname) r1 r2 = rtype ++ "[" ++ rname ++ "]" ++ " {\n" ++ (concatMap (\x -> x ++"\n") difflist) ++ "}"     where@@ -210,7 +209,28 @@         Left err -> error err     exitWith ExitSuccess +-- prints the content of a file+printContent :: String -> FinalCatalog -> IO ()+printContent filename catalog =+    case (Map.lookup ("file", filename) catalog) of+        Nothing -> error "File not found"+        Just r  -> case (Map.lookup "content" (rrparams r)) of+            Nothing -> error "This file has no content"+            Just (ResolvedString c)  -> putStrLn c+            Just x -> print x +r2s :: ResolvedValue -> String+r2s (ResolvedString x)  = x+r2s x                   = show x++-- filters resources by type name+getResourcesOfType :: String -> FinalCatalog -> FinalCatalog+getResourcesOfType rtype = Map.filter (\r -> rrtype r == rtype)++-- just extract the names of the resources+getResourceNames :: FinalCatalog -> [String]+getResourceNames cat = map snd $ Map.keys cat+ main :: IO () main = do     args <- getArgs@@ -220,10 +240,5 @@     queryfunc <- initializedaemon puppetdir     x <- queryfunc nodename     if length args == 3-        then case (Map.lookup ("file",args !! 2) x) of-            Nothing -> error "File not found"-            Just r  -> case (Map.lookup "content" (rrparams r)) of-                Nothing -> error "This file has no content"-                Just (ResolvedString c)  -> putStrLn c-                Just x -> print x+        then printContent (args !! 2) x         else putStrLn $ showFCatalog x
puppetresources.cabal view
@@ -2,13 +2,13 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                puppetresources-version:             0.1.1+version:             0.1.2 synopsis:            A program that displays the puppet resources associated to a node given .pp files. -- description:          license:             GPL-3 license-file:        LICENSE author:              Simon Marechal-maintainer:          simon@banquise.net+maintainer:          bartavelle@gmail.com homepage:            http://lpuppet.banquise.net -- copyright:            category:            System@@ -21,8 +21,8 @@   ghc-options:         -rtsopts   -- other-modules:          build-depends:       base >=3 && <5,-                       language-puppet >= 0.1.3,-                       hsfacter        >= 0.1.0.2,+                       language-puppet >= 0.1.7,+                       hsfacter        >= 0.1.0.3,                        containers,                        hslogger,                        Diff,