summaryrefslogtreecommitdiffstats
path: root/spec
Commit message (Collapse)AuthorAgeFilesLines
* Revert the guts of #2890Markus Roberts2010-02-172-45/+72
| | | | | | | | | | This patch reverts the semantically significant parts of #2890 due to the issues discussed on #3360 (security concerns when used with autosign, inconsistency between REST & XMLRPC semantics) but leaves the semantically neutral changes (code cleanup, added tests) in place. This patch is intended for 0.25.x, but may also be applied as a step in the resolution of #3450 (refactored #2890, add "remove_certs" flag) in Rolwf.
* Adding :catalog_terminus settingLuke Kanies2010-02-173-12/+35
| | | | | | | | | | This will rarely be used, but it enables even more architectural flexibility, such as precompiling catalogs and storing them in memcached or equivalent. With this setup, a single host can probably serve all catalogs and you would then just have as many compiling hosts as needed. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding support for only using cached catalogsLuke Kanies2010-02-171-1/+21
| | | | | | | | | This basically allows a sysadmin to control when a client will compile a new catalog - with this option enabled, the client will use the cached catalog as long as it has one, only recompiling when run with the option disabled. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Fix #3155 - prevent error when using two matching regex in cascadeBrice Figureau2010-02-174-8/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following manifest: case $var { /match/: { if $var =~ /matchagain/ { } } } is failing because the "=~" operators when matching sets an ephemeral variable in the scope. But the case regex also did it, and since they both belong to the same scope, and Puppet variables are immutables, the scope raises an error. This patch fixes this issue by adding to the current scope a stack of ephemeral symbol tables. Each new match operator or case/selector with regex adds a new scope. When we get out of the case/if/selector structure the scope is reset to the ephemeral level we were when entering it. This way the following manifest produces the correct output: case $var { /match(rematch)/: { notice("1. \$0 = $0, \$1 = $1") if $var =~ /matchagain/ { notice("2. \$0 = $0, \$1 = $1") } notice("3. \$0 = $0, \$1 = $1") } } notice("4. \$0 = $0") And the output is: 1. $0 = match, $1 = rematch 2. $0 = matchagain, $1 = rematch 3. $0 = match, $1 = rematch 4. $0 = Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Making a Puppet::Module test more resilientLuke Kanies2010-04-131-0/+1
| | | | | | It would fail if a directory unexpectedly existed. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fixing and porting Transaction Report testsLuke Kanies2010-04-122-1/+112
| | | | | | | There are still a few unported tests, but it's at least better now. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fixing Property#change_to_s in rare case failuresLuke Kanies2010-04-121-1/+15
| | | | | | | | | If we were removing a field, which really only 'cron' does, then we got an exception. This is fixed, and now tested. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fixing Hash functionality with non-constant keysLuke Kanies2010-04-121-5/+27
| | | | | | | It was only apparently working with constant keys, not, say, AST strings. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Porting/removing group test/unit testsLuke Kanies2010-04-121-0/+20
| | | | | | | Most of it was just complicated, and the rest useless. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Porting a simple set of tests from test/unitLuke Kanies2010-04-121-0/+19
| | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fixing Transaction integration testLuke Kanies2010-04-121-1/+1
| | | | | | | This was failing because it was expecting a call to Puppet::Type#evaluate, which is no longer used. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Removing invalid File integration testLuke Kanies2010-04-121-29/+2
| | | | | | | | | | | The point of this test was to confirm that we could take a given file resource and have it work multiple times in memory, but that's not actually possible given our current code. We copy the values over from the source metadata, and suddenly have no method for differentiation between values set by the user and those set by the remote source. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Cleaning up content/source codeLuke Kanies2010-04-122-36/+5
| | | | | | | | | | This is probably a slight refactor, but only because it fixed a bug (content not being copied over correctly from metadata), which required that slight refactor. Mostly this just makes the code a bit cleaner. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Protecting spec_helper chmod from failureLuke Kanies2010-04-121-2/+2
| | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Redeleting puppetmasterd integration testLuke Kanies2010-04-121-155/+0
| | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Making SshAuthorizedKeys tests less brittleLuke Kanies2010-04-121-2/+11
| | | | | | | Also making them less likely to try to modify the local filesystem in any way. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fix tests that use or stub find_by_checksum, which I just changed theJesse Wolfe2010-04-102-11/+12
| | | | signature of.
* Update YAML dir test to match behaviorJesse Wolfe2010-04-091-2/+2
|
* Fix heisenbug in spec/unit/provider/mount/parsed.rbJesse Wolfe2010-04-091-0/+1
| | | | | spec/unit/provider/mount/parsed.rb would show a failure when spec/unit/type/mount.rb had been run prior.
* Remove test for old RDoc work-aroundJesse Wolfe2010-04-091-96/+0
|
* Fixing various broken Resource::Type testsLuke Kanies2010-04-091-18/+19
| | | | | | Also making the code a bit cleaner. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Renaming and fixing puppetrun tests.Luke Kanies2010-04-091-7/+7
| | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fixing calls to "class_scope" in Scope testsLuke Kanies2010-04-091-3/+3
| | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Fixing all 'require' function testsLuke Kanies2010-04-092-11/+16
| | | | | | | This involved making some tests better, but mostly just involved fixing calls to use new APIs and such. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Removing any mentions of :casesensitive settingLuke Kanies2010-04-093-25/+33
| | | | | | | | | | | | | | | | | It is a setting that was added years ago as a backward compatibility option and even if it still works, which is questionable, it has no purpose any longer. It just complicated the code and didn't do much, so it's gone now. Also simplified the interface of Leaf#evaluate_match, since it was now using none of the passed-in options. Finally, removed/migrated the last of the Selector/CaseStatement test/unit tests. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Migrating "puppet" executable integration testLuke Kanies2010-04-091-3/+3
| | | | Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Puppet::Parser::AST::Leaf#evaluate_match "insensitive" renamed toJesse Wolfe2010-04-091-2/+2
| | | | "sensitive"
* Puppet::Parser::Resource.new parameters have changedJesse Wolfe2010-04-091-1/+1
|
* Add stub to Puppet::Parser::Collector test to prevent runaway stubJesse Wolfe2010-04-091-1/+5
| | | | failures
* Converted File[checksum] to a parameter not propertyLuke Kanies2010-02-174-60/+90
| | | | | | | | | At the same time I removed all of the code in checksum that managed tracking changes to the checksum over time. I'll add it back in as I fix the fact that changes aren't being tracked like the should at the moment. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding "checksum?" helper method to Checksums moduleLuke Kanies2010-02-171-0/+16
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Refactoring File[source] tests somewhatLuke Kanies2010-02-171-37/+26
| | | | | | | | | Replaced use of a stub resource with a real resource. This is in preparation for turning the 'checksum' property into a parameter. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Resolving conflicts with luke:tickets/testing/2954Markus Roberts2010-02-171-11/+11
|
* Adding virtual and exported resource support to the DSLLuke Kanies2010-02-172-58/+80
| | | | | | | | | | | Also changed the internals - we're no longer using Resource instances with the ruby block, instead we're using a simple new class. We had to do this because Resource has too many methods - e.g., 'file' returned the file name rather than created a new resource type. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Cleaning up ResourceAPI testsLuke Kanies2010-02-171-7/+1
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* s/DSL::ResourceHelper/DSL::ResourceAPI/gLuke Kanies2010-02-172-7/+7
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding simplistic pure ruby interfaceLuke Kanies2010-02-174-6/+232
| | | | | | | | | This is a simplistic DSL - you can create resource types (defined resources), classes, and nodes, and they can call functions and create resources. Nothing else, at this point. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding environment support to parser resourcesLuke Kanies2010-02-171-0/+9
| | | | | | We just use the scope's environment. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Moving the string interpolation parsing to the parser/lexerMarkus Roberts2010-02-171-163/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves the syntactic aspects of string interpolation up into the lexer/parser phase, preparatory to moving the semantic portions down to the as yet unnamed futures resolution phase. This is an enabling move, designed to allow: * Futures resolution in and between interpolated strings * Interpolation of hash elements into strings * Removal of certain order-dependent paths * Further modularization of the lexer/parser The key change is switching from viewing strings with interpolation as single lexical entities (which await later special case processing) to viewing them as formulas for constructing strings, with the internal structure of the string exposed by the parser. Thus a string like: "Hello $name, are you enjoying ${language_feature}?" internally becomes something like: concat("Hello ",$name,", are you enjoying ",$language_feature,"?") where "concat" is an internal string concatenation function. A few test cases to show the user observable effects of this change: notice("string with ${'a nested single quoted string'} inside it.") $v2 = 3+4 notice("string with ${['an array ',3,'+',4,'=',$v2]} in it.") notice("string with ${(3+5)/4} nested math ops in it.") ...and so forth. The key changes in the internals are: * Unification of SQTEXT and DQTEXT into a new token type STRING (since nothing past the lexer cares about the distinction. * Creation of several new token types to represent the components of an interpolated string: DQPRE The initial portion of an interpolated string DQMID The portion of a string betwixt two interpolations DQPOST The final portion of an interpolated string DQCONT The as-yet-unlexed portion after an interpolation Thus, in the example above (phantom curly braces added for clarity), DQPRE "Hello ${ DQMID }, are you enjoying ${ DQPOST }?" DQCONT is a bookkeeping token and is never generated. * Creation of a DOLLAR_VAR token to strip the "$" off of variables with explicit dollar signs, so that the VARIABLEs produced from things like "Test ${x}" (where the "$" has already been consumed) do not fail for want of a "$" * Reworking the grammar rules in the obvious way * Introduction of a "concatenation" AST node type (which will be going away in a subsequent refactor). Note finally that this is a component of a set of interrelated refactors, and some of the changes around the edges of the above will only makes sense in context of the other parts.
* Finishing renaming :params to :parameters internallyLuke Kanies2010-02-1711-29/+89
| | | | | | | | | | | | I had only done this partway, because it seemed easier, but not surprisingly, it ended up being more complex. In addition to those renames, this commit includes fixes to whatever tests I needed to fix to confirm that things were again working. I think most of these broken tests have been broken for a while. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Forcing parent evaluation in resource typesLuke Kanies2010-02-171-1/+44
| | | | | | | | | When a class is evaluated, its parent class needs to be evaluated first. This forces that evaluation. We somehow lost it when we converted the resource types out of AST. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Fixing type/title resource resolutionLuke Kanies2010-02-171-73/+121
| | | | | | | | | | | | | This code is impressively difficult, because sometimes resource types act like resources (classes and nodes are singletons) and sometimes like resource types (defined and builtin resources). So, to get nodes to show as Node[foo] and classes as Class[Foo::Bar], but defined resources to show up as Foo::Bar[baz], we have to do some silliness. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Converging the Resource classes furtherLuke Kanies2010-02-171-13/+13
| | | | | | | | | | | I was using 'params' and 'parameters', so I fixed that and extracted the differences in how they handle parameters into a stubbable method. This allowed me to almost entirely remove the subclass's 'initialize' method. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding strictness checking to resourcesLuke Kanies2010-02-172-49/+47
| | | | | | | This is used for AST resources (and fixed the last of the tests I broke in spec/). Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Fixing most of the broken tests in test/Luke Kanies2010-02-176-114/+231
| | | | | | | | This involves a bit of refactoring in the rest of the code to make it all work, but most of the changes are fixing or removing old tests. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding tmpfile cleanup to testsLuke Kanies2010-02-172-0/+24
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Removing Resource::Reference classesLuke Kanies2010-02-1724-449/+565
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is hopefully less messy than it first appears, but it's certainly cross-cutting. The reason for all of this is that we previously only looked up builtin resource types from outside the parser, but now that the defined resource types are available globally via environments, we can push that lookup code to Resource. Once we do that, however, we have to have environment and namespace information in every resource. Here I remove the Resource::Reference classes (except the AST class), and use Resource instances instead. I did this because the shared code between the two classes got incredibly complicated, such that they should have had a hierarchical relationship disallowed by their constants. This complexity convinced me just to get rid of References entirely. I also make Puppet::Parser::Resource a subclass of Puppet::Resource. There are still broken tests in test/, but this was a big enough commit I wanted to get it in. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Allowing Environment.new to take an environmentLuke Kanies2010-02-171-0/+5
| | | | | | | | | This can happen because we're almost always converting to environment instances from strings. Shouldn't happen often, but it's easier to be more failure-tolerant. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* TypeCollection now supports namespace arraysLuke Kanies2010-02-171-2/+9
| | | | | | | | | We previously only supported a single namespace when searching for resource types et al, but the whole system actually relies on an array of namespaces and search paths, so this adds that functionality all the way down, as it were. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adding parameter validation to Puppet::ResourceLuke Kanies2010-02-174-17/+121
| | | | | | | | | | | | | This will allow us to remove all of the parameter validation from the other Resource classes. This is possible because resource types defined in the language are visible outside of the parser, via the environment. This will enable lots of code removal and simplication. Signed-off-by: Luke Kanies <luke@reductivelabs.com>