summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fixed #1849 - Ruby 1.9 portability: `when' doesn't like colons, replace with ↵James Turnbull2009-02-265-14/+14
| | | | | | | | semicolons
* | Fix #1933 - Inconsistent resource evaluation order in subsequent evaluation runsBrice Figureau2009-02-141-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | While evaluating the AST, catalog vertices are not always ordered the same way on different run, leading to some tags (which should have been applied in evaluation order) to not be associated with some underlying resources. This changeset change all accesses to resources inside the compiler to always use an ordered (in evaluation order) list of added resources. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Merge branch '0.24.x'Luke Kanies2009-02-132-0/+110
|\| | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/indirector/facts/facter.rb lib/puppet/provider/augeas/augeas.rb lib/puppet/util/filetype.rb spec/unit/indirector/facts/facter.rb spec/unit/provider/augeas/augeas.rb test/util/filetype.rb
| * Fixed #1831 - Added sprintf functionJames Turnbull2009-02-141-0/+17
| |
| * Fixed #1830 - Added regsubst functionJames Turnbull2009-02-141-0/+93
| |
* | Merge branch '0.24.x'Luke Kanies2009-02-114-24/+24
|\| | | | | | | | | | | Conflicts: CHANGELOG spec/unit/type/file/selinux.rb
| * Fixed #1884 - exported defines are collected by the exporting hostLuke Kanies2009-02-112-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was caused by the fix to #1472. That fix unexported any resources collected from the local catalog. The crux of this fix is that it separates 'exported' and 'virtual' a bit more. It also removes no-longer-needed functionality where resources copied their virtual or exported bits from the enclosing define or class. This is now obsolete because we don't evaluate virtual defined resources. The crux of this commit is that defined resources can stay exported even though they're evaluated, and that exported state won't inherit to contained resources such that those then don't get evaluated. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Cleaning up the AST::Resource code a bitLuke Kanies2009-02-101-20/+21
| | | | | | | | | | | | | | | | | | | | | | Mostly renaming 'obj' to 'resource', since the whole 'obj' thing is a holdover from before we had the term 'resource'. Also pulling a bit of code out of a loop, since it didn't need to be there. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fix #1691 - Realize fails with array of Resource ReferencesBrice Figureau2009-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following snippet: realize( File["/tmp/a","/tmp/b"] ) is parsed into: AST::Function @name=realize @arguments= AST::ASTArray @children = [ AST::ResourceReference @title= AST::ASTArray @children = [ String(/tmp/a), String(/tmp/b) ] ] When evaluated: ResourceReference gives -> [ File[/tmp/a], File[/tmp/b] ] which means the function arguments are: [[File[/tmp/a], File[/tmp/b]] after evaluating the @arguments ASTArray of AST::Functions. Then the collector complains that it can't find the resource because it is not supposed to work on non-flattened resource array. The fix is to flatten in the realize function (although it can be done more generally in the AST::Function evaluation) before the resources are given to the Collector. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Fix #1682 - Resource titles are not flattened as they shouldBrice Figureau2009-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following manifest: $groups = ["foo", "bar"] $type_groups = ["baz", "quux"] $user_groups = [$groups, $type_groups] notify{ $user_groups: } which outputs: notice: foo notice: //Notify[foobar]/message: defined 'message' as 'foo' notice: baz notice: //Notify[bazquux]/message: defined 'message' as 'baz' is not equivalent to $user_groups = [ ["foo", "bar"], ["baz", "quux"] ] notify{ $user_groups: } which outputs: notice: foo notice: //Notify[foo]/message: defined 'message' as 'foo' notice: baz notice: //Notify[baz]/message: defined 'message' as 'baz' notice: bar notice: //Notify[bar]/message: defined 'message' as 'bar' notice: quux notice: //Notify[quux]/message: defined 'message' as 'quux' Obviously the second one manages to flatten the arrays and not the first one. This changeset adds flattening to the resource titles evaluations in order to be consitent in all cases. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Fix #1922 - Functions squash all arguments into a single hashBrice Figureau2009-02-111-1/+2
| | | | | | | | | | | | | | | | Revert "Fix #1682 - ASTArray should flatten product of evaluation of its children" This reverts commit c7ccc4ba7c42d56595564491ae578a1604c628d1. Bug #1824 and #1922 proved the fix for #1682 and #1691 was wrong. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Change the way the tags and params are handled in railsBrice Figureau2009-02-062-18/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | The rationale behind this patch is that it takes a lots of time to let rails unserialize the ParamValue and ResourceTag object on each compilation, just to throw them away the second after. The idea is to fetch directly (and batched host per host) the parameters and tags from the database and then returns them as hash. This allows the no-modification case to takes at least 2 times less than before. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Converting the catalog as neededLuke Kanies2009-02-061-3/+3
| | | | | | | | | | | | | | Converting to a Resource catalog for transmission, then converting to a RAL catalog on the client. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Change the way the tags and params are handled in railsBrice Figureau2009-02-062-18/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | The rationale behind this patch is that it takes a lots of time to let rails unserialize the ParamValue and ResourceTag object on each compilation, just to throw them away the second after. The idea is to fetch directly (and batched host per host) the parameters and tags from the database and then returns them as hash. This allows the no-modification case to takes at least 2 times less than before. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fixing #1913 - 'undef' resource values do not get copied to the dbLuke Kanies2009-02-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | There are unfortunately no tests for this patch; the Rails code is disappointingly low on tests as it is, and it would have been essentially an herculian effort add all of the necessary tests just to make sure this worked. I've verified it works in practice, which should be sufficient for now. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Fixing #1914 - 'undef' relationship metaparameters do not stackLuke Kanies2009-02-061-0/+1
| | | | | | | | | | | | | | | | This allows you to specify that a metaparameter is undef inside a definition and keep any parameters from being inherited from the parent. Signed-off-by: Luke Kanies <luke@madstop.com>
* | In order for ReST formatting to work properly, newlines andJames Turnbull2009-01-221-1/+1
| | | | | | | | | | | | indentation of doc strings must be retained. Signed-off-by: Thomas Bellman <bellman@nsc.liu.se>
* | Fix #1829 - Add puppet function versioncmp to compare versionsBrice Figureau2008-12-271-0/+10
| | | | | | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fix #1828 - Scope.number? wasn't strict enough and could produce wrong resultsBrice Figureau2008-12-271-3/+3
| | | | | | | | | | | | | | Some invalid numbers were treated as numbers and conversion to Integer was failing returning 0 (for instance 0.24.7). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Renaming the "Catalog#to_type" method to "Catalog#to_ral"Luke Kanies2008-12-181-2/+2
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Using Puppet::Resource to convert parser resources to RAL resourcesLuke Kanies2008-12-181-1/+1
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding resource convertion to the parser resourcesLuke Kanies2008-12-181-44/+32
| | | | | | | | | | | | | | Also uses Puppet::Resource's method for creating transportable resources. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Renaming Puppet::Node::Catalog to Puppet::Resource::CatalogLuke Kanies2008-12-181-2/+2
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Renaming Puppet::ResourceReference to Puppet::Resource::ReferenceLuke Kanies2008-12-093-4/+4
|/ | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #1741 - Add inline_template functionBrice Figureau2008-11-291-0/+21
|
* Fix #1741 - refactor TemplateWrapper, test for template functionBrice Figureau2008-11-292-24/+33
|
* Fix #1741 - Puppet::Parser::Functions rmfunctions and unit testBrice Figureau2008-11-291-0/+14
|
* Fixing #1755 - handling fully qualified classes correctly.Luke Kanies2008-11-262-4/+5
| | | | | | | This involves lexing '::class' tokens along with correctly looking them up from the Resource::Reference class. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #1759 - Comparison operator was using string comparison for numbersBrice Figureau2008-11-201-0/+4
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Move function existance test to parser evaluationBrice Figureau2008-11-171-12/+16
| | | | | | | | The aim is to let --parseonly succeeds even if the function is not (yet) present. This is usefull in commit-hooks and for the inline documentation generation system. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Add a doc attribute to AST nodes and fill it with the last seen commentsBrice Figureau2008-11-1717-111/+252
| | | | | | | | | | | | | The lexer maintains a stack of last seen comments. On blank lines the lexer flush the comments. On each opening brace the lexer enters a new stack level. On each block AST nodes, the stack is popped. Each AST nodes has a doc property that is filled with the last seen comments on node creation (in fact only on important node creation representing statements). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1402 - Allow multiline commentsBrice Figureau2008-10-291-0/+5
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #857 - Multiple class of the same name don't append codeBrice Figureau2008-10-291-1/+5
| | | | | | | | | | | | | | | | | | | | The following manifest wasn't working: class one { notice('class one') } class one { notice('second class one') } include one It all boiled down to class code not being arrays. Encapsulating code in ASTArray when needed is enough to append code, because of the property of ASTArray to evaluate all their members in turn. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1682 - ASTArray should flatten product of evaluation of its childrenBrice Figureau2008-10-291-2/+1
| | | | | If the ASTArray contains children that evaluate to arrays themselves, they aren't flattened.
* Fixed #1104 - Classes and nodes should set $name variablesBrice Figureau2008-10-281-1/+6
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fixes #1663 - added Symbol check and additional testSean E. Millichamp2008-10-231-1/+5
|
* Fix #936 - Allow trailing comma in array definitionBrice Figureau2008-10-212-388/+393
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1115 - part2 - fix tests and add all_tagsBrice Figureau2008-10-211-1/+6
| | | | | | | | Up until this patch, TemplateWrapper.tags was returning all the tags defined in the catalog. I think this is wrong and tags shoul only return the defined tags in the current scope. Hence, I defined a all_tags method that returns the list of tags defined in the whole catalog.
* Fixed #1663 - Regression relating to facter fact naming from 0.24.5James Turnbull2008-10-211-1/+2
|
* Fix #636 - Allow extraneous comma in function argument listBrice Figureau2008-10-212-882/+898
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1115 - Allow checking tags/classes from ERb templatesBrice Figureau2008-10-141-0/+10
| | | | | | | | Add to predefined variables to the ERB template space. "classes" and "tags" which provide arrays of all the defined classes and tags for a node. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1202 - Collection attribute matching doesn't parse arraysBrice Figureau2008-10-081-1/+6
| | | | | | | | | | | | This patch allows to do this: User <| groups == leads |> @user { "foo": ensure => "present", groups => ["bar","baz","leads"] } Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1109 - allow empty if or else branchesBrice Figureau2008-10-074-563/+637
| | | | | | | | | | | | This changesets allow empty if or else branches: if true { } else { } It works by emitting on the parser stack an AST node that doesn't do anything (a no-op). This allows the less intrusive code as no part of the if evaluation code has been touched.
* Fix #381 - Allow multiple resource overrides or referencesBrice Figureau2008-10-054-390/+383
| | | | | | | | | | | | | | | | | | | | | | | Allow this syntax: Resource[title1,title2] { param => value } as a compact form of Resource[title1] { param => value } Resource[title2] { param => value } This patch also introduces for free the possibility to group class references by type: exec { test: require => File["file1","file2","File3"] } which is completely equivalent to: exec { test: require => [ File["file1"],File["file2"],File["File3"] ] }
* Fixing #1098 - Multiline strings now correctly increment the line countLuke Kanies2008-10-041-0/+3
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Add parser for arbitrary expressionsBrice Figureau2008-10-013-645/+1020
| | | | | | | | | | | | | | | | The expressions can be used in if 'test' and in the right side of assignements. The expressions can contain any number of sub-expressions combined by either arithmetic operators, comparison operators, or boolean operators. Random Usage Examples: $result = ((( $two + 2) / $one) + 4 * 5.45) - (6 << 7) + (0x800 + -9) or if ($a < 10) and ($a + 10 != 200) { ... }
* Add arithmetic operators to ASTBrice Figureau2008-09-304-0/+89
| | | | | This changeset adds +,-,/,*,<< and >> computation and AST parse nodes.
* Add not operator to ASTBrice Figureau2008-09-302-0/+20
|
* Add comparison operators (< > == != <= >=) to ASTBrice Figureau2008-09-302-0/+38
|
* Add boolean operators to ASTBrice Figureau2008-09-302-0/+49
|