summaryrefslogtreecommitdiffstats
path: root/spec/unit
Commit message (Collapse)AuthorAgeFilesLines
...
| * | [#4716] ResourceTypeAPI exposes implementation details that are likely to changePaul Berry2010-09-222-21/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Partial merge to 2.6.2rc1 : Merge commit '7b8cb74' into nextJesse Wolfe2010-10-021-0/+1
|\| | | | | | | | | | | There are merge conflicts with commits following this one.
| * | Fix for #4708 - tagmail should allow . in tagnameDan Bode2010-09-231-0/+1
| | | | | | | | | | | | changed the regex so that tagmail allows . in tagname.
* | | Merge commit '2.6.1' into nextJesse Wolfe2010-09-132-0/+13
|\| |
| * | [#4756] addendum for #4756Jesse Wolfe2010-09-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes spec and unit tests indirectly related to the previous patch-revert. One failure was from trying to test the User Type's roles, when, on many platforms, the roles feature wasn't supported by the default Provider. Other tests could fail on some platforms because they assumed that unsupported attributes would be ignored with a warning, but the code was crashing instead.
| * | Fix for Bug #4756 - Providers no longer respect missing featuresJames Cammarata2010-09-141-0/+8
| | | | | | | | | | | | Restored deleted lines from type.rb and reinstated unit tests
* | | Merge commit '2.6.1rc4' into nextJesse Wolfe2010-09-139-9/+11
|\| |
| * | Fix for #4646 -- Missing stubMarkus Roberts2010-09-071-1/+1
| | | | | | | | | | | | The test was expecting a stub object but wasn't providing one.
| * | Fix for tests broken by fix for #4489 -- stub standaloneMarkus Roberts2010-09-071-0/+1
| | | | | | | | | | | | | | | | | | If the file streaming is to be thwarted when running standalone the test for standalone needs to be stubbed when running specs, lest the tests inexplicably fail.
| * | [#4308] Remove puppettest from specsMatt Robinson2010-09-035-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Fixed RSpec warning messagesJames Turnbull2010-08-312-2/+2
| | |
* | | 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 remote branch 'paul/ticket/next/4570' into nextJesse Wolfe2010-09-081-0/+25
|\ \ \ \ | |_|/ / |/| | |
| * | | Fixed issue #4570 (Race conditions when serializing objects to YAML).Paul Berry2010-08-231-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ZAML class was using class variables to keep track of labels and backreferences while serializing object to YAML. This made it possible to get ill-formed or incorrect YAML output if two threads tried to serialize objects at the same time. Changed to use instance variables of the ZAML class, so there is no race condition. Also added some more spec tests to verify that labels are generated properly.
* | | | Merge commit '2.6.1rc3' into nextJesse Wolfe2010-08-275-29/+68
|\ \ \ \ | |_|/ / |/| | / | | |/ | |/|
| * | 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).
| * | Fix for #4518 -- classes not getting added to compiler.classesMarkus Roberts2010-08-211-0/+17
| | | | | | | | | | | | | | | | | | | | | The responsibility for adding classes to the compiler's classes list (for use in constructing classes.txt) moved around a bit in the 0.25 to 2.6 transition before being dropped in a merge conflict resolution. Ooops. This restores it, and adds tests to prevent regression.
| * | [#4545] Remove obsolete 'trac' specsJesse Wolfe2010-08-211-19/+0
| | | | | | | | | | | | | | | The method that these specs were testing has been removed, causing the specs to fail.
| * | Maint. -- Fix test failures broken by previous commitMarkus Roberts2010-08-211-6/+18
| | | | | | | | | | | | | | | | | | | | | This basically involved adding a search method to the yaml indirector, which I did by copying the one from ssl_file and fiddling with it until the tests passed. Since the most straight forward way to do this required extending the interface to the path method I added tests for the additional behaviour.
| * | [#4298] Puppet apply prints an error if the file to apply doesn't existMatt Robinson2010-08-211-3/+21
| |/ | | | | | | | | | | | | | | Also warns you it's skipping files if you pass it more than one file to apply. Reviewed-by: Nick Lewis <nick@puppetlabs.com> Signed-off-by: Matt Robinson <matt@puppetlabs.com>
* | Merge remote branch 'paul/4472-4483-4496-4521-4522'Jesse Wolfe2010-08-1714-242/+351
|\ \ | |/ |/| | | a.k.a. "make_taller_trees"
| * [#4496]+[#4521]+[#4522] Add structures to the AST to represent type ↵Paul Berry2010-08-1312-97/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Moved perform_initial_import from Puppet::Resource::TypeCollection to ↵Paul Berry2010-08-134-67/+64
| | | | | | | | | | | | | | | | | | | | | | | | Puppet::Node::Environment. This change is part of an ongoing effort to remove functionality from TypeCollection that is not related to keeping track of a collection of types. This reduces TypeCollection's linkage to the environment, which is a step toward decoupling it from the type loading mechanism. Also, added a spec test to verify that TypeCollection.version is correctly recomputed when types are re-imported.
| * [#4472]+[#4483] Moved type-name resolution out of Puppet::Parser::TypeLoader.Paul Berry2010-08-123-96/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-3010-55/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Further RST to Markdown fixes for types, values, testsJames Turnbull2010-08-121-2/+2
| |
* | Maint. Passenger fix broke a testMarkus Roberts2010-08-061-3/+3
| | | | | | | | The content-length fix for passenger broke a test; this fixes it.
* | 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.
* | [#4364] Fix failing spec due to incorrect loglevelJesse Wolfe2010-08-041-1/+1
| | | | | | | | | | A spec was failing since it wasn't updated when the #4364 change was made.
* | Fix for #4465 -- earlier "feature" patch broke ldapMarkus Roberts2010-08-041-17/+19
| | | | | | | | | | | | | | | | | | The patch for #3904 should not have been accepted; it's buggy and the use case (supporting having nodes in ldap more than once with the same name but distinct records) is ill-conceived. This commit reverts the patch (a7884b47) and the previous attempt to fix it (e6709da4), restoring the old (0.25.x) behaviour.
* | [#4467] Make Puppet Master respect facts_terminus settingsRein Henrichs2010-08-042-6/+13
| | | | | | | | | | | | | | | | | | * Remove hard-coded facts terminus in master * Change facts_terminus default to 'yaml' for master and 'facter' for everything else. Paired-with: Matt Robinson <matt@puppetlabs.com> Signed-off-by: Rein Henrichs <rein@puppetlabs.com>
* | [#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-0310-55/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix #4349 - Parsing with ignoreimport=true was always loading site.ppMarkus Roberts2010-07-251-0/+8
| | | | | | | | | With the type collection refactoring, when accessing a fresh collection puppet tries to import the site.pp manifest (perfrom_initial_import). In the case of puppetdoc, we are parsing site.pp by ourselves, so we ended parsing it twice, resulting in an "import loop detected" error. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #4348 - Puppet doc single manifest brokenBrice Figureau2010-07-251-0/+13
| | | | | | | | The refactoring of using environment instances instead of strings for initializing the parser, rdoc wasn't updated, thus was unable to initialize the parser. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* extlookup() is a builtinJesse Wolfe2010-07-251-0/+85
| | | | | | This patch promotes extlookup() to being a builtin function. It also adds test and makes some minor tweaks to the code. The behavior of extlookup has been left unchanged.
* [#4333] old optparse doesn't support default_argv=Jesse Wolfe2010-07-251-12/+2
| | | | | optparse hasn't always had the concept of default_argv. Fortunately, we don't really need it.
* Fix #4319 - source file url sent to the master is invalidBrice Figureau2010-07-251-1/+1
| | | | | | | | | | | We were sending an incorrect (containing a //) url for sourced file content since the file streaming patches. Depending on the webserver in front of puppet it could fail (for instance nginx+mongrel). This patch fixes the offending // in each sourced file urls. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix for #4303 -- reverting to old escaping in '-stringsMarkus Roberts2010-07-251-0/+3
| | | | | Single quoted used to allow escape on single quotes and pass all other characters through without comment; now the do again.
* Fix #4302 - Compilation speed regression compared to 2.6Brice Figureau2010-07-251-3/+32
| | | | | | | | | | | | | | | | | | | | | Each time the compiler was accessing the loaded types, we were checking if the manifests had changed. This incurred a large performance cost compared to 0.25 and introduced race conditions if manifests changed while a thread was in the middle of a compilation. This tentative fix, based on Brice's, makes sure each thread will get access to the same loaded types collection for the durration of a compilation, even if the manifests change. We now only check for changed files at the start of a compilation or if the environment changes, and we maintain a per environment thread lock so that only one thread at a time can be reloading any particular environment (and the need-check is done inside the synchronize block so that only the first will actually load it). As long as the manifests don't change, the threads will share the same collection, so there is only duplication in memory for a brief window surrounding a change. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com> Second-author: Markus Roberts <markus@puppetlabs.com>
* Fix #4286 - rename puppetdoc global module <site> to __site__Brice Figureau2010-07-251-3/+3
| | | | | | | | | < and > might be invalid or borderline chars to use for a file name or an url. This patch changes those characters to __. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>