summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | 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>
* | | maint: Fix tests that don't run on their ownMatt Robinson2010-11-221-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>
* | | Merge commit '2.6.3' into nextPaul Berry2010-11-174-58/+51
|\| | | |/ |/| | | | | | | Resolved conflicts manually: spec/integration/indirector/bucket_file/rest_spec.rb spec/integration/indirector/certificate_revocation_list/rest_spec.rb
| * 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>
* | Merge commit '2.6.3rc2' into nextPaul Berry2010-11-093-6/+8
|\| | | | | | | | | | | Manually resolved conflicts: lib/puppet/parser/ast/resource.rb spec/unit/parser/ast/resource_spec.rb
| * (#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.
* | Merge remote branch 'paul/ticket/next/4657' into nextJesse Wolfe2010-10-054-9/+21
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch conflicts with a backport of itself. This merge resolution favors the original patch for the code changes, and the 2.6.2 patch for the specs. Manually Resolved Conflicts: lib/puppet/dsl/resource_type_api.rb lib/puppet/parser/ast/definition.rb lib/puppet/parser/parser_support.rb spec/integration/parser/ruby_manifest_spec.rb spec/unit/dsl/resource_type_api_spec.rb
| * | [#4657] Customer-supplied .rb files are not compatible with multiple ↵Paul Berry2010-09-024-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | environments or staleness check Changed the resource type API to create AST objects rather than directly instantiating resource types. This allows the same code paths to be used to handle the results of parsing both .pp and .rb files. This makes .rb files work properly in multiple environments, because the types are now instantiated by code that is aware of which environment the compilation is happening in. It also reduces the risk of future changes breaking .rb file support. Also, switched to using "instance_eval" rather than "require" to evaluate the contents of the .rb file. This ensures that if the file has to be recompiled (because it became stale), it will actually get re-evaluated. As a side benefit, ResourceTypeAPI is now a class rather than a mixin to Object, so its methods do not pollute the global namespace. To reduce the risk of customers coming to rely on implementation details of the resource type API, changed its methods to return nil, and removed methods from it that were misleadingly labeled as "private".
* | | Merge commit '2.6.2rc1' into nextJesse Wolfe2010-10-043-2/+3
|\ \ \ | | |/ | |/|
| * | 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.
* | | Partial merge to 2.6.2rc1 : Merge commit '574812e' into nextJesse Wolfe2010-10-041-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | The API for AST objects has changed, making the initialization of this spec somewhat more complicated. Also, git seems to have been confused by whitespace changes. Manually Resolved Conflicts: lib/puppet/parser/ast/resource.rb
| * | (#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.
* | | Partial merge to 2.6.2rc1 : Merge commit '8cd1540' into nextJesse Wolfe2010-10-021-1/+1
|\| | | | | | | | | | | There are merge conflicts with commits following this one.
| * | [#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.
* | | Partial merge to 2.6.2rc1 : Merge commit 'f950061' into nextJesse Wolfe2010-10-021-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Some specs were in conflict, as they had been recently modified to use the API functionality that f950061 removes. This merge commit simply restores the verson of those specs from f950061. Manually Resolved Conflicts: spec/unit/dsl/resource_type_api_spec.rb
| * | [#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.
* | | Partial merge to 2.6.2rc1 : Merge commit '2b50f30' into nextJesse Wolfe2010-10-022-59/+59
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2b50f30 simplified and fixed bugs in code that had already been modified extensively by 4da88fb and 6b1dd81. This merge resolution commit is a manual replay of the changes from 2b50f30 onto next. Manually Resolved Conflicts: lib/puppet/parser/type_loader.rb spec/unit/parser/type_loader_spec.rb
| * | [#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.
* | | Partial merge to 2.6.2rc1 : Merge commit '7b8cb74' into nextJesse Wolfe2010-10-022-3/+10
|\| | | | | | | | | | | There are merge conflicts with commits following this one.
| * | 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
| | |
* | | Merge commit '2.6.1rc4' into nextJesse Wolfe2010-09-133-144/+135
|\| |
| * | 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
| | |
* | | Merge remote branch 'paul/ticket/next/4685' into nextJesse Wolfe2010-09-096-1910/+1770
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts resolved manually, by Paul Berry: lib/puppet/parser/ast/astarray.rb lib/puppet/parser/grammar.ra lib/puppet/parser/parser.rb (by rebuilding from grammar.ra)
| * | | Modified the error message that is generated when a class, definition,Paul Berry2010-09-075-141/+145
| | |/ | |/| | | | | | | | | | or node occurs in a conditional construct so that it contains the proper line number.
| * | [#4685] Classes, defines, and nodes allowed inside of non-evaluated conditionalsPaul Berry2010-09-013-1160/+1118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, ASTArray#evaluate() was responsible for checking whether the user had tried to declare a class, define, or node in a prohibited location (such as a conditional construct). This meant that errors would only be reported to the user if the conditional code was actually evaluated. Moved the checking into the parser, so that errors are always reported.
* | | Merge remote branch 'paul/ticket/next/4638' into nextJesse Wolfe2010-09-099-463/+315
|\ \ \ | |/ / |/| |
| * | [4638] Cleanup of plurals and inheritance relationships in ASTPaul Berry2010-08-279-463/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed the grammar so that the following "plural" constructs always parse as an ASTArray: - funcvalues - rvalues - resourceinstances - anyparams - params - caseopts - casevalues And the following "singluar" construct never parses as an ASTArray: - statement The previous behavior was for these constructs to parse as a scalar when they represented a single item and an ASTArray when they contained zero or multiple items. ("Statement" could sometimes represent a single item because a single resource declaration could represent multiple resources). This complicated other grammar rules and caused ambiguous handling of nested arrays. Also made these changes to the AST class hierarchy: - ResourceInstance no longer derives from ASTArray. This relationship was not meaningful because a ResourceInstance is a (title, parameters) pair, not an array, and it produced complications when we wanted to represent an array of ResourceInstance objects. - Resource no longer derives from ResourceReference. No significant functionality was being inherited and the relationship doesn't make sense in an AST context. - ResourceOverride no longer derives from Resource. No significant functionality was being inherited and the relationship doesn't make sense in an AST context. - Resource can now represent a compound resource instance such as "notify { foo: ; bar: }". This saves the parser from having to use represent a statement as an array of objects. - ASTArray's evaluate method never flattens out arrays of arrays.
* | | Merge commit '2.6.1rc3' into nextJesse Wolfe2010-08-271-13/+6
|\ \ \ | |/ / |/| / | |/
| * 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).
* | Merge remote branch 'paul/4472-4483-4496-4521-4522'Jesse Wolfe2010-08-1710-1530/+1662
|\ \ | |/ |/| | | a.k.a. "make_taller_trees"
| * [#4496]+[#4521]+[#4522] Add structures to the AST to represent type ↵Paul Berry2010-08-1310-1499/+1637
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | definitions (classes, definitions, and nodes). Previously, type definitions were not represented directly in the AST. Instead, the parser would instantiate types and insert them into known_resource_types as soon as they were parsed. This made it difficult to distinguish which types had come from the file that was just parsed and which types had been loaded previously, which led to bug 4496. A side-effect of this change is that the user is no longer allowed to define types inside of conditional constructs (such as if/else). This was allowed before but had unexpected semantics (bugs 4521 and 4522). It is still possible, however, to place an "include" statement inside a conditional construct, and have that "include" statement trigger the autoloading of a file that instantiates types.
| * [#4472]+[#4483] Moved type-name resolution out of Puppet::Parser::TypeLoader.Paul Berry2010-08-122-38/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved type-name resolution out of Puppet::Parser::TypeLoader, and into its primary client, Puppet::Resource::TypeCollection. TypeCollection now always passes fully qualified type names to TypeLoader. This avoids duplicate type-name resolution logic between TypeLoader and TypeCollection. That in turn fixes bug 4472, which resulted from flaws in the type-name resolution logic in TypeLoader. In addition, it fixes bug 4483, which resulted from improper interleaving between looking up names using the TypeCollection and the TypeLoader.
| * [#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the ↵Jesse Wolfe2010-07-304-10/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST resources. Move type-name resolution out of Puppet::Resource into the AST resources. Move find_resource_type out of Puppet::Resource into Scope Thus, never pass unqualified type names to Puppet::Resource objects. Thus, Puppet::Resource objects don't need the namespace property, and Puppet::Resource objects never consult the harddrive to look for .pp files that might contain their type definitions, Thus, performance is improved. Also removes the temporary fix for #4257 that caused #4397 (The code was too eager to look for a class in the topscope) Paired-With: Paul Berry <paul@puppetlabs.com> Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* | 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.
* | [#4370] Fixes extlookup precedence getting overwritten between runsMatt Robinson2010-08-033-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We found the gsub! in extlookup was actually modifying the value for extlookup_precedence, so the next node to call it just got the interpolated value from the first run. We did two things in the code to prevent this: 1. We returned a dup of the ast string object so that modifying it wouldn’t change puppet’s state. We didn’t do this for all possible return values because we depend on using the original ast array object to do array concatenation 2. We fixed extlookup to not do a destructive gsub Reviewed by: Jesse Wolfe