summaryrefslogtreecommitdiffstats
path: root/test/data/snippets
Commit message (Collapse)AuthorAgeFilesLines
* Fix #2389 - Enhance Puppet DSL with HashesBrice Figureau2010-02-171-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bring a new container syntax to the Puppet DSL: hashes. Hashes are defined like Ruby Hash: { key1 => val1, ... } Hash keys are strings, but hash values can be any possible right values admitted in Puppet DSL (ie function call, variables access...) Currently it is possible: 1) to assign hashes to variable $myhash = { key1 => "myval", key2 => $b } 2) to access hash members (recursively) from a variable containing a hash (works for array too): $myhash = { key => { subkey => "b" }} notice($myhash[key][subjey]] 3) to use hash member access as resource title 4) to use hash in default definition parameter or resource parameter if the type supports it (known for the moment). It is not possible to string interpolate an hash access. If it proves to be an issue it can be added or work-arounded with a string concatenation operator easily. It is not possible to use an hash as a resource title. This might be possible once we support compound resource title. Unlike the proposed syntax in the ticket it is not possible to assign individual hash member (mostly to respect write once nature of variable in puppet). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Enhance selector and case statements to match with regexpBrice Figureau2009-08-012-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | The case and selector statements define ephemeral vars, like 'if'. Usage: case statement: $var = "foobar" case $var { "foo": { notify { "got a foo": } } /(.*)bar$/: { notify{ "hey we got a $1": } } } and for selector: $val = $test ? { /^match.*$/ => "matched", default => "default" } Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2033 - Allow regexp in if expressionBrice Figureau2009-08-012-6/+12
| | | | | | | | | | | | | | | | | | | This changeset introduces regexp in if expression with the use of the =~ (match) and !~ (not match) operator. Usage: if $uname =~ /Linux|Debian/ { ... } Moreover this patch creates ephemeral variables ($0 to $9) in the current scope which contains the regex captures: if $uname =~ /(Linux|Debian)/ { notice("this is a $1 system") } Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2333 - Make sure lexer skip whitespace on non-tokenBrice Figureau2009-06-121-0/+4
| | | | | | | | | Comments and multi-line comments produces no token per-se during lexing, so the lexer loops to find another token. The issue was that we were not skipping whitespace after finding such non-token. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Removed extra whitespace from end of linesIan Taylor2009-06-063-5/+5
|
* Changed tabs to spaces without interfering with indentation or alignmentIan Taylor2009-06-062-6/+6
|
* Fix #1088 - part2 - Add rspec testsBrice Figureau2009-03-141-0/+8
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1402 - Allow multiline commentsBrice Figureau2008-10-291-0/+6
| | | | 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/+9
| | | | | | | | | | | | | | | | | | | | 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 #936 - Allow trailing comma in array definitionBrice Figureau2008-10-211-0/+3
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #636 - Allow extraneous comma in function argument listBrice Figureau2008-10-211-0/+5
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1109 - allow empty if or else branchesBrice Figureau2008-10-071-0/+9
| | | | | | | | | | | | 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.
* Add parser for arbitrary expressionsBrice Figureau2008-10-012-0/+14
| | | | | | | | | | | | | | | | 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 rspec unit test for the append operatorBrice Figureau2008-09-211-0/+11
| | | | Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fixed #997 -- virtual defined types are no longer evaluated.Luke Kanies2008-02-122-13/+20
| | | | | | | NOTE: This introduces a behaviour change, in that you previously could realize a resource within a virtual defined resource, and now you must realize the entire defined resource, rather than just the contained resource.
* All tests should now pass again.Luke Kanies2007-10-081-2/+2
| | | | | | | | | | | | | | This is the first real pass towards using caching. The `puppet` executable actually uses the indirection work, instead of handlers and such (and man! is it cleaner). Most of this work was a result of trying to get the client-side story working, with correct yaml caching of configurations, which means this commit also covers converting configurations to yaml, which was a much bigger PITA than it needed to be. I still need to write integration tests, and I also need to cover the server-side story of a normal configuration retrieval.
* All tests now pass in this configuration branch, which meansLuke Kanies2007-09-221-14/+0
| | | | | | | | it's time to merge it back into the indirection branch. Considering that this work was what drove me to create the indirection branch in the first place, i should now be able to merge both back in the master branch.
* Fixing #615 (subclasses with similar names) by getting rid of the class ↵luke2007-05-033-16/+13
| | | | | | "type" and "fqname", and instead using "classname" everywhere. You should no longer see unqualified class/definition names anywhere. Also, rewriting how snippet tests work, to avoid creating all of the files, since the point was the parsing tests, not functional tests. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2458 980ebf18-57e1-0310-9a29-db15c13687c0
* Partially fixing #460, take 3 -- fully-qualified classes can now be included.luke2007-01-301-2/+2
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2128 980ebf18-57e1-0310-9a29-db15c13687c0
* Partially fixing #460, take 2 -- fully-qualified definitions can now be used.luke2007-01-302-0/+16
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2127 980ebf18-57e1-0310-9a29-db15c13687c0
* Re-enabling the dirchmod test and fixing its syntaxluke2007-01-041-6/+2
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2041 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #348. Overrides now support an extra end-comma.luke2006-12-231-1/+1
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1969 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #343. Collections and definition evaluation both now happen on every ↵luke2006-12-231-0/+13
| | | | | | iterative evaluation, with collections being evaluated first. This way collections can find resources that either are inside defined types or are the types themselves. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1967 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing #349. Doing some hackery so defined types can now (again) be used as ↵luke2006-12-231-0/+8
| | | | | | dependencies. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1966 980ebf18-57e1-0310-9a29-db15c13687c0
* Reworking the package tests. Now providers are tested individuallyluke2006-12-141-2/+2
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1921 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding a "realize" function that can be used to make one or more resource ↵luke2006-10-181-0/+14
| | | | | | non-virtual. It is just syntactic sugar for a collection by title. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1808 980ebf18-57e1-0310-9a29-db15c13687c0
* Fixing virtual object collection. I apparently broke it when I added rails ↵luke2006-10-181-0/+10
| | | | | | collection back, and I never created any end-to-end tests. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1805 980ebf18-57e1-0310-9a29-db15c13687c0
* Merging the changes from the override-refactor branch. This is a ↵luke2006-10-0428-0/+478
significant rewrite of the parser, but it has little affect on the rest of the code tree. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1726 980ebf18-57e1-0310-9a29-db15c13687c0