summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
Commit message (Collapse)AuthorAgeFilesLines
* (#5392) Give a better error when realizing a non-existant resourceMatt Robinson2011-03-091-4/+5
| | | | | | | | | | | You can reproduce the error with a simple manifest Bogus_type <| title == 'foo' |> We used to fail because find_resource_type returned nil and we never checked if it was nil before calling methods on it. Reviewed-by: Max Martin <max@puppetlabs.com>
* Merge branch 'maint/2.6.next/revert-5935' into 2.6.nextNick Lewis2011-02-282-980/+962
|\
| * Revert "(#5935) Allow functions to accept negated values"Nick Lewis2011-02-212-980/+962
| | | | | | | | | | | | | | | | This reverts commit e3c59df2b246fe5e764272f21b631a5d2f28687f. This commit is being reverted because the solution is incomplete, and a better solution is out of scope for this release. A more complete solution will be implemented in the future.
* | (#6338) Remove unused version control tagsMatt Robinson2011-02-281-3/+0
|/ | | | | | | Older version control systems like CVS and SVN used to use these $Id$ tags for version information. Paired-with: Nick Lewis
* (#5935) Allow functions to accept negated valuesNick Lewis2011-02-172-962/+980
| | | | | | | | | function(-1) was failing because the grammar wasn't allowing negated values in function calls. This fix makes the negation of any value which was previously legal as a function argument also now legal as a function argument. Paired-With: Max Martin Paired-With: Markus Roberts
* (Fixes #6269) merge changes from masterzen that resolve the issue.Daniel Pittman2011-02-122-393/+401
|\ | | | | | | parser.rb manually rebuilt to resolve global grammer chances.
| * Fix #6269 - Hashes only work with two levels of accessBrice Figureau2011-02-122-800/+793
| | | | | | | | | | | | | | | | | | | | The following manifest was failing: $hash = { 'a' => { 'b' => { 'c' => 'it works' } } } $out = $hash['a']['b']['c'] because of a typo in the grammar. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | (#5516) Rebuild parser.rb after merge.Daniel Pittman2011-02-121-1541/+1630
| | | | | | | | | | The automatically generated parser.rb needed to be rebuilt to make the syntax changes functional; this commits only that rebuild.
* | Merge branch 'masterzen/tickets/2.6.x/5516' into ↵Daniel Pittman2011-02-122-426/+416
|\ \ | | | | | | | | | bug/2.6.next/5516-hashes-can't-be-used-in-selectors
| * | Fix #5516 - Hashes can't be used in selectorsBrice Figureau2011-02-122-426/+416
| |/ | | | | | | | | | | | | | | | | | | | | | | | | The following manifest was producing a parse error: $int = { 'eth0' => 'bla' } $foo = $int['eth0'] ? { 'bla' => 'foo', default => 'bleh' } because selectors didn't support hash access. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Merge branch 'masterzen/tickets/2.6/5720' into ↵Daniel Pittman2011-02-123-5/+8
|\ \ | | | | | | | | | bug/2.6.next/5720-puppetdoc-fails-on-parameterized-class
| * | Fix #5720 - puppetdoc misses some class commentsBrice Figureau2011-02-112-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It appears that the fix for #5252 wasn't complete, and class, nodes and definition were still using the current lexer line number instead of the line number of the class/define/node token. This combined with some missing comments stack pushing/pop on parenthesis prevented puppetdoc to correctly get the documentation of some class (including parametrized ones). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | Fix #6280 - puppetdoc crashing on string interpolationBrice Figureau2011-02-111-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | The following manifest was crashing puppetdoc: class test { include "test::$operatingsystem" } Because the quoted string is "rendered" as a concat AST, which in turn ended being an array when entering RDoc. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | (#6270) Fix formatting in split function's doc stringnfagerlund2011-02-091-7/+7
| | | | | | | | | | | | * Repaired a 2-indent/4-indent issue that kept a code block from being recognized * Wrapped literal strings in backticks to format as code and protect from Markdown * Added note about backslashes for escaping metacharacters.
* | (#6270) Fix formatting in regsubst function's doc stringnfagerlund2011-02-091-14/+7
|/ | | | | | * Fixed ULs being interpreted as code blocks * Changed an example for variety. * Turned set of paragraphs inside a LI into a nested list.
* Merge branch 'tickets/2.6.x/5564' into 2.6.nextPaul Berry2011-02-011-3/+6
|\ | | | | | | | | * tickets/2.6.x/5564: Fixed #5564 - Added some more fqdn_rand documentation
| * Fixed #5564 - Added some more fqdn_rand documentationJames Turnbull2011-02-011-3/+6
| | | | | | | | Reviewed-by: Paul Berry <paul@puppetlabs.com>
* | Merge branch 'ticket/2.6.next/5045' into 2.6.nextMatt Robinson2011-02-011-3/+18
|\ \ | | | | | | | | | | | | | | | | | | * ticket/2.6.next/5045: (#5045) Cleaning up some tests and code (#5045) External node classifiers should be able to specify params for classes (#5045) Adds support to resource/type to also accept a param hash
| * | (#5045) Cleaning up some tests and codeMatt Robinson2011-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | Renamed some variables to be clearer, made tests use less stubbing, added some additional tests and got rid of some unecessary logic. Paired-with: Dan Bode
| * | (#5045) External node classifiers should be able to specify params for classesDan Bode2011-01-241-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It facilitates the support for param classes from the ENC. It adds support for classes to be passed as a hash to the evaluate_classes method. If a hash of classes is specified, it also evaluates duplicates. I also had to convert the hash to an array for tags to be applied correctly. Reviewed-by: Matt Robinson
* | | (#5944) Remove documentation of define() when used on nodes, as it is not a ↵nfagerlund2011-01-251-21/+3
| | | | | | | | | | | | | | | | | | supported use of this function. Final patch in this series reviewed by Dan Bode.
* | | (#5944) Further edits of inline defined() documentation.nfagerlund2011-01-251-25/+30
| | | | | | | | | | | | Fixing use of define/declare; editing for clarity.
* | | (#5944) Improve documentation of defined() functionnfagerlund2011-01-251-6/+41
|/ / | | | | | | The differences in the way defined() handles different types of entities weren't well-explained. Documentation was also added for the behavior of defined(Node["somenode.domain.com"]).
* | maint: Prune #inspect methods on various objectsJesse Wolfe2011-01-031-0/+4
| | | | | | | | | | | | | | | | | | | | Ruby's default #inspect method can lead to printing factorial-order output for large graphs of objects. Since we have large graphs of objects, this is not optimal. This patch replaces a few well-connected objects' #inspect methods with methods that produce reduced output, and are thus much faster. Paired-With: Nick Lewis <nick@puppetlabs.com>
* | maint: Fix tests that don't run on their ownMatt Robinson2010-12-161-0/+1
|/ | | | | | | | | | | | | | | From the spec directory I found all the specs that fail when run on their own. for TEST in `find . -name "*.rb" -type f`; do spec $TEST > /dev/null 2>&1 if [[ $? != 0 ]]; then echo $TEST fi done All of them were cases of missing requires. Paired-with: Nick Lewis <nick@puppetlabs.com>
* Fix for #5298 -- Collections need to do type lookupMarkus Roberts2010-11-161-1/+2
| | | | | | | | | | | | | When the responsibility for type-name resolution was moved to the AST nodes in commit 449315a2c705df2396852462a1d1e14774b9f117, at least one instance was missed: the space ship operator Myclass <<| tag == foo |>> fails unless Myclass has been previously loaded. This commit adds the lookup to AST::Collection nodes in the same way it was added to the other node types. Note that I haven't audited the other note types for similar cases.
* Step towards [5298] -- cleanup indentation, etc. in AST::CollectionMarkus Roberts2010-11-161-51/+33
| | | | My code smell routines bobbled this one, so I'm fixing it manually.
* Fix #4921 - race condition in Parser Functions creationBrice Figureau2010-11-121-2/+4
| | | | | | | The autoloading is not thread safe, which means two threads could both autoload the same function at the same time. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #5252 - line number mis-attribution during parsingBrice Figureau2010-11-111-3/+3
| | | | | | | | | | | | | | | It is a resurgence of #2366 that appeared because of the commit 8971d8. Before this commit, for associating documentation comments, we were preferring line numbers coming from the parser currently reducing rule, instead of the current lexer line number (which can be in advance of several tokens due to the nature of LALR parsers). We now merge the ast line number before fetching the comment from the lexer. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #5127 - error when accessing array elementsBrice Figureau2010-11-101-2/+10
| | | | | | | | | | | Accesing an array with an integer index (ie $array[1]) is producing a ruby error: can't convert String into Integer This is because the array index is not properly converted to an number before the array element lookup is performed. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* (#4534/#4778) -- Normalize parameterized classesPaul Berry2010-10-272-5/+6
| | | | | | | | | | | | | | | | | | | This is a reconciliation/melding of Paul's (#4534) Class inheritance with parameterized classes is no longer ignored and Markus's Fix for #4778 -- evaluate parameterized classes when they are instantiated Extracted the code from Resource::Type#mk_plain_resource that evaluates parents and tags the catalog, and moved that into a new method called instantiate_resource. Instantiate_resource is now also called from Parser::Ast::Resource#evaluate, so that the notation "class { classname: }" now executes this code too. Likewise adds class evaluation so that it behaves the same (with regard to lazy / strict evaluation) as include classname
* Fix for #5022 -- Escaped newlines should be elidedMarkus Roberts2010-10-181-1/+2
| | | | | | | | | | | This was a regression, not covered by a test; previously the string "foo\ bar" would be interpreded as "foobar" but this was changed to "foo\\\nbar" in 2.6.x with my string interpolation refactor. This change restores the behaviour.
* Fixed documentation typoJames Turnbull2010-10-011-1/+1
|
* Fixes #4792 (Duplicate definition since 2.6.1 upgrade)Paul Berry2010-09-301-0/+1
| | | | | | | | | | | | | | | The evaluate_definitions method was first figuring out which resources needed to be evaluated (using unevaluated_resources), and then evaluating them one by one. As a result, if evaluating one resource triggered another resource to be evaluated, the latter resource could get evaluated twice. This bug could occur, for example, if both resources were classes that were included into the node by an external node classifier, and if the first of the two classes included the second. Modified Resource#evaluate to be idempotent. Also added an integration test to verify the fix.
* Fix for #4804 -- escaped backslashes in interpolated stringsMarkus Roberts2010-09-281-1/+1
| | | | | | | | Part of the ongoing refinement / cleanup of the string interpolation semantics. When scanning for an unescaped string terminator we now also allow an 0 or more pairs of backslashes (that is, escaped backslashes) before the terminator. Thanks to Jacob for the test I should have added.
* (#4860) Add regression tests that would have caught bad params methodMatt Robinson2010-09-281-5/+1
| | | | | This is another case where our test objects were overly mocked so they didn't alert us to problems with our implementation.
* [#4692] undefined variables cause :undef to be passed to functionsPaul Berry2010-09-221-1/+1
| | | | | | | | | | The :undef symbol, which we use internally to distinguish between undefined variables and variables whose value is the empty string, is being leaked in calls to functions (e.g. "split"). This is a departure from 0.25.x behavior, where undefined variables evaluated to "". This patch restores the 0.25.x behavior.
* [#4716] ResourceTypeAPI exposes implementation details that are likely to changePaul Berry2010-09-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | Made the following modifications to ResourceTypeAPI: (1) returned nil from “define”, “hostclass”, and “node”. (2) renamed “mk_resource_type” and “munge_type_arguments” to “__mk_resource_type__” and “__munge_type_arguments__” to discourage customers from calling them. (3) Made ResourceTypeAPI a class rather than a module, and changed the parser to evaluate the contents of pure ruby manifests using a instances of this class. (4) Changed ResourceTypeAPI to insert newly instantiated types into Thread.current[:known_resource_types] rather than the default environment's known_resource_types. This effectively backports the fix for issue #4657 to 2.6.x. Also backported the new spec tests from #4657.
* [#4771] Import of manifests with the same name only happens oncePaul Berry2010-09-232-49/+51
| | | | | | | | | | | | | | | The function import_if_possible, which was supposed to be responsible for making sure that no two threads tried to import the same file at the same time, was not making this decision based on the full pathname of the file, since it was being invoked before pathnames were resolved. As a result, if we attempted to import two distinct files with the same name at the same time (either in two threads or in a single thread due to recursion), one of the files would not always get imported. Fixed this problem by moving the thread-safety logic to happen after filenames are resolved to absolute paths. This made it possible to simplify the thread-safety logic significantly.
* Minimal fix for #4631 -- set implicit classes as in 0.25.xMarkus Roberts2010-09-231-0/+7
| | | | | | | This is a minimal fix for #4631 by reversing one part of the refactor for #1903 commit 0d4fd60c7c143cc1f4e4b0f99f359c09cbfbf21e. It fixes the immediate issue (implicit classes not being added to resources) but leaves open several other questions which are defered to #4687.
* Fixed versioncmp function typoJames Turnbull2010-09-161-1/+1
|
* Documentation updates for Markdown conversionJames Turnbull2010-09-141-3/+3
|
* Fix for #4693 -- implicit stages should never be serializedMarkus Roberts2010-09-071-1/+1
| | | | | | | | | | | My fix for #4542 was overly enthusiastic about assuring that all resources had a stage, resulting in stages designations being serialized for resources in manifests which did not use resources (everything was in implicit main). This broke 0.25.x compatibility, as all catalogs now refered to stages. This patch scales back the change for #4542 slightly, supressing the setting of main on the puppetmaster and relying on the default behaviour on the client (for 2.6.x and later, treat it as main; for 0.25.x, do nothing).
* Fixed extlookup documentation and spacingJames Turnbull2010-08-312-143/+134
|
* Fix for #4542 -- included classes weren't assigned proper stagesMarkus Roberts2010-08-241-13/+6
| | | | | | This commit unifies the code paths on which classes are added, alters the default stage to respect the stage of the parent if any, and assures that the resource is notified if its stage is assigned (turning an implicit stage into an explicit one).
* Rewrote functions documentation to MarkdownJames Turnbull2010-08-1111-48/+50
|
* Fixes #4485 -- single quoted strings should not treat \n as new lineMarkus Roberts2010-08-051-11/+11
| | | | | | | | | | | | This is the rest of the change for #4303; James and I discussed various ways the solution to that ticket needed to be extended but, as neither of us committed code, nothing changed. This is the least implact extension, which mimics the behaviour of prior versions. It leaves open the question: should '\\x' start with a single or double backslash? If, as now, '\\x' starts with a double backslash (i.e. single quote is the only escapable characterin single quoted strings) a string ending in a backslash can not be represented in a single quoted string.
* [#4404] Remove requirement for source on Parser::Resource::ParamNick Lewis2010-08-041-1/+1
| | | | | | | | Stage[main] is created without an associated source, to which Parser::Resource::Param objects. This patch observes that the source attribute of both Parser::Resource and Parser::Resource::Param seem not to be used anywhere, and removes the requirement that it be supplied.
* added md5 support as requested in ↵Alice Kærast2010-08-031-0/+5
| | | | http://serverfault.com/questions/166199/puppet-md5-sum-of-string
* [#4381] extlookup shouldn't trigger reparses of .pp filesJesse Wolfe2010-08-031-3/+0
| | | | | | | extlookup was adding its data files to the list of watched source files. This causes the .pp manifests to be re-parsed whenever the .csv files change, which is no longer necessary, as the .csv files are already reparsed on every function call.