summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
Commit message (Collapse)AuthorAgeFilesLines
...
| * Merge branch 'masterzen/tickets/2.6.x/5516' into ↵Daniel Pittman2011-02-121-0/+6
| |\ | | | | | | | | | bug/2.6.next/5516-hashes-can't-be-used-in-selectors
| | * Fix #5516 - Hashes can't be used in selectorsBrice Figureau2011-02-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | misc: ast_context has two arguments, not one.Daniel Pittman2011-02-121-1/+1
| | | | | | | | | | | | | | | This updates the spec expectation to reflect that, eliminating a warning during the spec run.
| * | Fix #5720 - puppetdoc misses some class commentsBrice Figureau2011-02-112-0/+43
| |/ | | | | | | | | | | | | | | | | | | | | 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>
* | (#6582) eliminate a backtrace from mismatched block arguments.Daniel Pittman2011-03-031-1/+1
| | | | | | | | | | | | | | | | This was tightly coupled to the code implementation; it mostly still is, but now allows argument extension without needing to adjust the test which is only focused on the first argument anyhow. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* | (#6582) Eliminate the old fakedata helper method.Daniel Pittman2011-03-031-4/+1
| | | | | | | | | | | | | | | | This is replaced with the new my_fixture{,s} methods; old fixture data is ported into the spec tests at the same time, but left where it was against unit tests that require it. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* | Merge branch '2.6.x' into nextMatt Robinson2011-02-021-5/+90
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: (46 commits) Augmentation of tests for prior commit Fix to fix for #5755 -- backref serialization issues in zaml Fixed #5564 - Added some more fqdn_rand documentation Fixed #4968 - Updated list of options turned on by --test in documentation (#5061) - allow special hostclass/define variables to be evaluated as defaults. (#6107) Fix an error when auditing a file with empty content Remove already initialized constant warning from file_spec.rb tests (#5566) Treat source only File checksums as syntax errors when used with content Rename variable used in File type validation to be more clear Remove invalid "timestamp" and "time", and add missing "ctime" File checksum types. Remove order dependency when specifying source and checksum on File type Bug #5755 -- ZAML generates extra newline in some hash backreferences. bug #5681 -- code fix to handle AIX mount output Bug #5681 -- parse AIX mount command output. Spec for #5681 to allow parsing of AIX mount output in mount provider Fixed #6091 - Changed POSIX path matching to allow multiple leading slashes Bug #6091 -- test leading double-slash in filenames are allowed. Fixed #6071 - Fixed typo and improved exec path error message Fixed #6061 - Allowed -1 as password min/max age Bug #6061 -- verify that negative {min,max}_password_age are accepted. ... Manually Resolved Conflicts: lib/puppet/util/zaml.rb spec/unit/util/zaml_spec.rb
| * (#5045) Cleaning up some tests and codeMatt Robinson2011-01-241-27/+57
| | | | | | | | | | | | | | 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-0/+55
| | | | | | | | | | | | | | | | | | | | 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
* | Merge branch '2.6.x' into nextNick Lewis2011-01-062-8/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Rakefile lib/puppet/resource/type_collection.rb lib/puppet/simple_graph.rb lib/puppet/transaction.rb lib/puppet/transaction/report.rb lib/puppet/util/metric.rb spec/integration/indirector/report/rest_spec.rb spec/spec_specs/runnable_spec.rb spec/unit/configurer_spec.rb spec/unit/indirector_spec.rb spec/unit/transaction/change_spec.rb
| * (#5771) Upgrade rspec to version 2Matt Robinson2011-01-042-8/+5
| | | | | | | | | | | | | | | | | | The biggest change is that we no longer need to monkey patch rspec to get confine behavior. Describe blocks can now be conditional like confine used to be. "describe" blocks with "shared => true" are now "shared_examples_for". Paired-With: Nick Lewis
| * maint: Fix tests that don't run on their ownMatt Robinson2010-12-162-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Use expand_path when requiring spec_helper or puppettestMatt Robinson2010-12-0653-53/+53
| | | | | | | | | | | | | | | | | | Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe
* | maint: Fix tests that don't run on their ownMatt Robinson2010-11-222-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 intermittent parser spec failuresNick Lewis2010-11-171-21/+21
| | | | | | | | | | | | The variable 'ast' was being used as shorthand for Puppet::Parser::AST, but a test was also trying to use it as a local variable, causing problems.
* | Merge commit '2.6.3' into nextPaul Berry2010-11-174-5/+58
|\| | | | | | | | | | | 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-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Fixed #5296 - test warnings messagesJames Turnbull2010-11-162-3/+3
| |
| * Fix #5252 - line number mis-attribution during parsingBrice Figureau2010-11-111-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+42
| | | | | | | | | | | | | | | | | | | | | | 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-104/+151
|\| | | | | | | | | | | Manually resolved conflicts: lib/puppet/parser/ast/resource.rb spec/unit/parser/ast/resource_spec.rb
| * (#4534/#4778) -- Normalize parameterized classesPaul Berry2010-10-272-96/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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 commit '2.6.2rc1' into nextJesse Wolfe2010-10-041-0/+8
|\|
| * Fix for #4804 -- escaped backslashes in interpolated stringsMarkus Roberts2010-09-281-0/+8
| | | | | | | | | | | | | | | | 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 '8cd1540' into nextJesse Wolfe2010-10-021-4/+14
|\| | | | | | | There are merge conflicts with commits following this one.
| * [#4692] undefined variables cause :undef to be passed to functionsPaul Berry2010-09-221-4/+14
| | | | | | | | | | | | | | | | | | | | 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-9/+0
|\| | | | | | | | | | | | | | | | | 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-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-021-15/+3
|\| | | | | | | | | | | | | | | | | | | 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-231-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge commit '2.6.1rc4' into nextJesse Wolfe2010-09-131-1/+0
|\|
| * [#4308] Remove puppettest from specsMatt Robinson2010-09-031-1/+0
| | | | | | | | | | | | | | | | | | The less stuff being done in the spec_helper the better for reasoning about what's happening in the tests. puppettest.rb does a lot of things that aren't necessary for the specs, so this patch gets those things out of the spec_helper. Reviewed by: Jesse Wolfe
* | Merge remote branch 'paul/ticket/next/4685' into nextJesse Wolfe2010-09-092-2/+8
|\ \ | | | | | | | | | | | | | | | | | | 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-072-2/+8
| | | | | | | | | | | | | | | or node occurs in a conditional construct so that it contains the proper line number.
* | | Merge remote branch 'paul/ticket/next/4638' into nextJesse Wolfe2010-09-093-42/+35
|\ \ \ | |/ / |/| |
| * | [4638] Cleanup of plurals and inheritance relationships in ASTPaul Berry2010-08-273-42/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+12
|\ \ \ | |/ / |/| / | |/
| * Fix for #4542 -- included classes weren't assigned proper stagesMarkus Roberts2010-08-241-1/+12
| | | | | | | | | | | | 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-177-126/+200
|\ \ | |/ |/| | | a.k.a. "make_taller_trees"
| * [#4496]+[#4521]+[#4522] Add structures to the AST to represent type ↵Paul Berry2010-08-137-68/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-121-65/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fixes #4485 -- single quoted strings should not treat \n as new lineMarkus Roberts2010-08-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | [#4370] Fixes extlookup precedence getting overwritten between runsMatt Robinson2010-08-032-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | [#4423] repair parameterized class instantiationJesse Wolfe2010-08-031-0/+7
| | | | | | | | | | | | My earlier #4397 patch was not aware of the parameterized class instantiation syntax, and failed on manifests that instantiate parameterized classes.
* | [#4423] class { shouldn't get stored on the namespace stackJesse Wolfe2010-08-031-0/+6
| | | | | | | | | | | | | | The new syntax for instantiating parameterized classes was confusing the lexer's notion of namespaces. This is a simple fix to prevent that syntax from polluting the namespaces.
* | [#4397]+[#4344] Move type-name resolution out of Puppet::Resource into the ↵Jesse Wolfe2010-08-034-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | [#4344] Fix for failing templates when module name matches file in local dir.Paul Berry2010-08-032-4/+4
| | | | | | | | | | | | | | | | | | When the name of a module matches the name of a file in the local directory, puppet agent would sometimes try to read that file and interpret it as puppet code. This happened because files.rb was unintentionally permitting puppet files without an extension. Fixed by changing the glob pattern to only permit ".pp" and ".rb" extensions.
* | [#4242] Fixed (removed) a broken unit testNick Lewis2010-08-031-22/+0
|/ | | | | This test ran into a mocha bug, and was stubbing too much anyway. It's being moved to an acceptance test.