summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
Commit message (Collapse)AuthorAgeFilesLines
* Fix #1933 - Inconsistent resource evaluation order in subsequent evaluation runsBrice Figureau2009-02-141-1/+26
| | | | | | | | | | | | | 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/+130
|\ | | | | | | | | | | | | | | | | | | 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/+42
| |
| * Fixed #1830 - Added regsubst functionJames Turnbull2009-02-141-0/+88
| |
* | Merge branch '0.24.x'Luke Kanies2009-02-114-6/+160
|\| | | | | | | | | | | Conflicts: CHANGELOG spec/unit/type/file/selinux.rb
| * Fixed #1884 - exported defines are collected by the exporting hostLuke Kanies2009-02-112-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Fix #1691 - Realize fails with array of Resource ReferencesBrice Figureau2009-02-111-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+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>
* | Converting the catalog as neededLuke Kanies2009-02-061-1/+12
| | | | | | | | | | | | | | Converting to a Resource catalog for transmission, then converting to a RAL catalog on the client. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Fixing #1914 - 'undef' relationship metaparameters do not stackLuke Kanies2009-02-061-0/+9
| | | | | | | | | | | | | | | | 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>
* | Merge commit 'masterzen/tickets/1834'Luke Kanies2008-12-302-2/+3
|\ \
| * | Fix #1834 part2 - Fix tests when no railsBrice Figureau2008-12-202-2/+3
| | | | | | | | | | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | | Fix #1829 - Add puppet function versioncmp to compare versionsBrice Figureau2008-12-271-0/+29
| | | | | | | | | | | | 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-0/+14
|/ / | | | | | | | | | | | | 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>
* | Deprecating the Puppet::Type.create.Luke Kanies2008-12-181-2/+2
| | | | | | | | | | | | | | This method is no longer necessary; you can use the normal 'new' class method. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Finishing the work to use Puppet::Resource instead of TransObjectLuke Kanies2008-12-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | This was a complicated project because TransObject had made its way into too many classes. The usage by Util::Settings was particularly nefarious. Refactoring and fixing this exposed some other issues. The main complication, though, was the extent to which the Puppet::Type class depended on TransObject. Signed-off-by: Luke Kanies <luke@madstop.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-3/+3
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding resource convertion to the parser resourcesLuke Kanies2008-12-181-0/+80
| | | | | | | | | | | | | | 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-1/+1
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Merge branch '0.24.x'Luke Kanies2008-12-0216-110/+651
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bin/puppetca lib/puppet/type/group.rb lib/puppet/type/tidy.rb lib/puppet/util/settings.rb Also edited the following files so tests will pass: lib/puppet/type/component.rb spec/unit/ssl/certificate_request.rb spec/unit/type/computer.rb spec/unit/type/mcx.rb spec/unit/type/resources.rb spec/unit/util/settings.rb spec/unit/util/storage.rb test/ral/type/zone.rb
| * Fix #1741 - fix some failing tests on some ruby versions.Brice Figureau2008-12-021-5/+5
| | | | | | | | | | | | Nigelk reported those tests were failing on ubuntu 8.04. I wasn't able to reproduce the issue myself but he confirmed the above patch fixed the tests.
| * Fixing the AST constant warnings, using a variable instead of a constantLuke Kanies2008-12-026-74/+74
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fix #1741 - Add inline_template functionBrice Figureau2008-11-291-0/+59
| |
| * Fix #1741 - refactor TemplateWrapper, test for template functionBrice Figureau2008-11-292-19/+100
| |
| * Fix #1741 - Puppet::Parser::Functions rmfunctions and unit testBrice Figureau2008-11-291-0/+83
| |
| * Fixing #1755 - handling fully qualified classes correctly.Luke Kanies2008-11-262-0/+56
| | | | | | | | | | | | | | This involves lexing '::class' tokens along with correctly looking them up from the Resource::Reference class. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Removing the included testing gems; you must now install them yourself.Luke Kanies2008-11-251-6/+35
| | | | | | | | | | | | Everything passes, but autotest doesn't include color. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fix #1759 - Comparison operator was using string comparison for numbersBrice Figureau2008-11-201-10/+50
| | | | | | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Move function existance test to parser evaluationBrice Figureau2008-11-171-0/+77
| | | | | | | | | | | | | | | | 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>
| * RSpec tests for the doc system (covers AST.doc, lexer and parser)Brice Figureau2008-11-173-5/+121
| | | | | | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fixing a test broken by previous refactoringLuke Kanies2008-11-071-7/+4
|/ | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #1402 - Allow multiline commentsBrice Figureau2008-10-291-1/+29
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #857 - Multiple class of the same name don't append codeBrice Figureau2008-10-291-0/+28
| | | | | | | | | | | | | | | | | | | | 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-0/+66
| | | | | 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-0/+13
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fixes #1663 - added Symbol check and additional testSean E. Millichamp2008-10-231-0/+9
|
* Fix #936 - Allow trailing comma in array definitionBrice Figureau2008-10-211-0/+8
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1115 - part2 - fix tests and add all_tagsBrice Figureau2008-10-211-1/+7
| | | | | | | | 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/+14
|
* Fix #636 - Allow extraneous comma in function argument listBrice Figureau2008-10-211-0/+24
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1115 - Allow checking tags/classes from ERb templatesBrice Figureau2008-10-141-0/+14
| | | | | | | | 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-0/+92
| | | | | | | | | | | | 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-072-0/+46
| | | | | | | | | | | | 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.
* Rspec Tests for #381.Brice Figureau2008-10-053-1/+154
| | | | Moved part of the old resource reference tests to rspec.
* Fixing #1098 - Multiline strings now correctly increment the line countLuke Kanies2008-10-041-0/+21
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Add parser for arbitrary expressionsBrice Figureau2008-10-012-4/+80
| | | | | | | | | | | | | | | | 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-303-0/+159
| | | | | This changeset adds +,-,/,*,<< and >> computation and AST parse nodes.
* Add not operator to ASTBrice Figureau2008-09-301-0/+30
|