language-puppet 1.3.4.1 → 1.3.5
raw patch · 3 files changed
+76/−72 lines, 3 files
Files
- CHANGELOG.markdown +4/−0
- Puppet/Interpreter.hs +71/−71
- language-puppet.cabal +1/−1
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+# v1.3.5 (2017/01/31)++* Ignored packages are not parsed anymore+ # v1.3.4.1 (2017/01/12) * Version bump for the directory dependency
Puppet/Interpreter.hs view
@@ -129,44 +129,44 @@ concat <$> mapM expandableDefine withDefaults where expandDefine :: Resource -> InterpreterMonad [Resource]- expandDefine r = do- let deftype = dropInitialColons (r ^. rid . itype)- defname = r ^. rid . iname- modulename = getModulename (r ^. rid)- curContType = ContDefine deftype defname (r ^. rpos)- p <- use curPos- -- we add the relations of this define to the global list of relations- -- before dropping it, so that they are stored for the final- -- relationship resolving- let extr = do- (dstid, linkset) <- itoList (r ^. rrelations)- link <- toList linkset- return (LinkInformation (r ^. rid) dstid link p)- extraRelations <>= extr- void $ enterScope SENormal curContType modulename p- (spurious, stmt) <- interpretTopLevel TopDefine deftype- DefineDecl _ defineParams stmts cp <- extractPrism "expandDefine" _DefineDecl stmt- let isImported (ContImported _) = True- isImported _ = False- isImportedDefine <- isImported <$> getScope- curPos .= r ^. rpos- curscp <- getScope- when isImportedDefine (pushScope (ContImport (r ^. rnode) curscp ))- pushScope curContType- ignored <- isIgnoredModule modulename- out <- if ignored- then return mempty- else do- loadVariable "title" (PString defname)- loadVariable "name" (PString defname)- -- not done through loadvariable because of override errors- loadParameters (r ^. rattributes) defineParams cp S.Nothing- curPos .= cp- res <- evaluateStatementsFoldable stmts- finalize (spurious ++ res)- when isImportedDefine popScope- popScope- return out+ expandDefine r =+ let modulename = getModulename (r ^. rid)+ in isIgnoredModule modulename >>= \i ->+ if i+ then return mempty+ else do+ let deftype = dropInitialColons (r ^. rid . itype)+ defname = r ^. rid . iname+ curContType = ContDefine deftype defname (r ^. rpos)+ p <- use curPos+ -- we add the relations of this define to the global list of relations+ -- before dropping it, so that they are stored for the final+ -- relationship resolving+ let extr = do+ (dstid, linkset) <- itoList (r ^. rrelations)+ link <- toList linkset+ return (LinkInformation (r ^. rid) dstid link p)+ extraRelations <>= extr+ void $ enterScope SENormal curContType modulename p+ (spurious, stmt) <- interpretTopLevel TopDefine deftype+ DefineDecl _ defineParams stmts cp <- extractPrism "expandDefine" _DefineDecl stmt+ let isImported (ContImported _) = True+ isImported _ = False+ isImportedDefine <- isImported <$> getScope+ curPos .= r ^. rpos+ curscp <- getScope+ when isImportedDefine (pushScope (ContImport (r ^. rnode) curscp ))+ pushScope curContType+ loadVariable "title" (PString defname)+ loadVariable "name" (PString defname)+ -- not done through loadvariable because of override errors+ loadParameters (r ^. rattributes) defineParams cp S.Nothing+ curPos .= cp+ res <- evaluateStatementsFoldable stmts+ out <- finalize (spurious ++ res)+ when isImportedDefine popScope+ popScope+ return out -- | Given a toplevel (type, name), -- return the associated parsed statement together with its evaluated resources@@ -659,40 +659,40 @@ <+> showPPos pp <> ")") Nothing -> do loadedClasses . at name' ?= (incltype :!: p)- -- load the actual class, note we are not changing the current position right now- (spurious, stmt) <- interpretTopLevel TopClass name'- ClassDecl _ classParams inh stmts cp <- extractPrism "loadClass" _ClassDecl stmt- -- check if we need to define a resource representing the class- -- This will be the case for the first standard include- inhstmts <- case inh of- S.Nothing -> return []- S.Just ihname -> loadClass ihname (S.Just name') mempty ClassIncludeLike- let !scopedesc = ContClass name'- modulename = getModulename (RIdentifier "class" name')- secontext = case (inh, loadedfrom) of- (S.Just x,_) -> SEChild (dropInitialColons x)- (_,S.Just x) -> SEParent (dropInitialColons x)- _ -> SENormal- void $ enterScope secontext scopedesc modulename p- classresource <- if incltype == ClassIncludeLike- then do- scp <- use curScope- fqdn <- getNodeName- return [Resource (RIdentifier "class" name') (HS.singleton name') mempty mempty scp Normal mempty p fqdn]- else return []- pushScope scopedesc+ let modulename = getModulename (RIdentifier "class" name') ignored <- isIgnoredModule modulename- out <- if ignored- then return mempty- else do- loadVariable "title" (PString name')- loadVariable "name" (PString name')- loadParameters params classParams cp (S.Just name')- curPos .= cp- res <- evaluateStatementsFoldable stmts- finalize (classresource ++ spurious ++ inhstmts ++ res)- popScope- return out+ if ignored+ then return mempty+ else do+ -- load the actual class, note we are not changing the current position right now+ (spurious, stmt) <- interpretTopLevel TopClass name'+ ClassDecl _ classParams inh stmts cp <- extractPrism "loadClass" _ClassDecl stmt+ -- check if we need to define a resource representing the class+ -- This will be the case for the first standard include+ inhstmts <- case inh of+ S.Nothing -> return []+ S.Just ihname -> loadClass ihname (S.Just name') mempty ClassIncludeLike+ let !scopedesc = ContClass name'+ secontext = case (inh, loadedfrom) of+ (S.Just x,_) -> SEChild (dropInitialColons x)+ (_,S.Just x) -> SEParent (dropInitialColons x)+ _ -> SENormal+ void $ enterScope secontext scopedesc modulename p+ classresource <- if incltype == ClassIncludeLike+ then do+ scp <- use curScope+ fqdn <- getNodeName+ return [Resource (RIdentifier "class" name') (HS.singleton name') mempty mempty scp Normal mempty p fqdn]+ else return []+ pushScope scopedesc+ loadVariable "title" (PString name')+ loadVariable "name" (PString name')+ loadParameters params classParams cp (S.Just name')+ curPos .= cp+ res <- evaluateStatementsFoldable stmts+ out <- finalize (classresource ++ spurious ++ inhstmts ++ res)+ popScope+ return out ----------------------------------------------------------- -- Resource stuff
language-puppet.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: language-puppet-version: 1.3.4.1+version: 1.3.5 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/