summaryrefslogtreecommitdiffstats
path: root/spec/unit
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | (#5552) Display help when no subcommand is given.Daniel Pittman2011-02-221-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when the command line was empty we would try and invoke an empty method; this was less helpful than telling people what they could actually do, so we adapt our code to do precisely that. Paired-With: Jesse Wolfe <jesse@puppetlabs.com> Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
* | | | (#5552) Clean up subcommand handling inside puppet cert.Daniel Pittman2011-02-221-14/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now have a regular, testable mechanism for handling the legacy '--' version of subcommands, as well as a modern bareword subcommand pattern. This makes it sensible to test command handling and avoid regressions. We identified a few quirks in the command line as part of this process. Pair-With: Jesse Wolfe <jesse@puppetlabs.com> Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
* | | | Merge branch 'ticket/2.6.next/6376-_search-support' into 2.6.nextMax Martin2011-02-211-1/+5
|\ \ \ \
| * | | | (#6376) Add test case for facts find requestMax Martin2011-02-211-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added test case to ensure indirection name is not changed from "facts" when making an HTTP GET request. Reviewed-by:Paul Berry <paul@puppetlabs.com>
* | | | | Merge branch '2.6.x' into 2.6.nextJacob Helwig2011-02-214-47/+101
|\ \ \ \ \ | | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.6.x: Updated CHANGELOG for 2.6.5rc5 (#6337) Fix Ruby warning on 1.8.6 about "future compatibility" (#6353) Restore the ability to store paths in the filebucket (#6126) Puppet inspect now reports status after run completes.
| * | | | (#6353) Restore the ability to store paths in the filebucketPaul Berry2011-02-213-46/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2274d5104f6e413a2b8899a3c3111a17bbb2f4d7 optimized network usage for the case where a file is already in the filebucket. However, it took away the ability to store paths. This change restores the ability to store paths while maintaining optimal network usage for the case where the file is already in the filebucket with the given path. This is expected to be the most common case. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
| * | | | (#6126) Puppet inspect now reports status after run completes.Daniel Pittman2011-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now emit timing and output a status message at the end of a successful inspect run. Paired-With: Nick Lewis <nick@puppetlabs.com> Signed-Off-By: Daniel Pittman <daniel@puppetlabs.com>
* | | | | Merge branch 'tickets/2.6.x/6309-check-what-is-mounted' into 2.6.nextJacob Helwig2011-02-183-115/+140
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | * tickets/2.6.x/6309-check-what-is-mounted: Remove pending tests from parsed mount provider (#6309) Ensure the correct device is mounted when managing mounts Clean up whitespace, and commented out code in parsed mount provider
| * | | | Remove pending tests from parsed mount providerJacob Helwig2011-02-181-10/+0
| | | | | | | | | | | | | | | | | | | | Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
| * | | | (#6309) Ensure the correct device is mounted when managing mountsJacob Helwig2011-02-183-105/+140
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the mount type would only check if anything was mounted at the desired point, when 'ensure => mounted' was specified. Now we check not only whether something is mounted at the desired point, but also that it is the thing we wish to be mounted there. There is also a chance that the mount point directory could be "automagically" removed for us, when unmounting incorrect devices, so we attempt to re-create the directory after unmounting to give the mount of the correct device a better chance at succeeding. Paired-with: Matt Robinson <matt@puppetlabs.com> Paired-with: Nick Lewis <nick@puppetlabs.com> Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
| * | | (#5977) fix spec test failure when new applications are introduced.Daniel Pittman2011-02-141-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test here was previously fragile, in that it would break when new applications were introduced, and in that it depended on the order of items returned from reading the directories on disk. It is now insensitive to those changes, and still verifies that the results we require occur, reducing long term maintenance cost. Reviewed-by: James Turnbull <james@puppetlabs.com>
* | | | (#6376) Add support and testing for _search GET requestsMax Martin2011-02-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support for adding "_search" to the end of any indirection to 'pluralize' it, and added tests to check this functionality and to test hidden side effect of plurality method unpluralizing indirections. Paired-With:Paul Berry <paul@puppetlabs.com>
* | | | (#5166) Inventory service is now searchable by timestamp.Paul Berry2011-02-171-0/+103
| | | | | | | | | | | | | | | | | | | | It is now possible to specify queries in the form “meta.timestamp.xx” where xx is eq,ne,gt,lt,ge,le when searching the inventory service.
* | | | Refactored Puppet::Node::Inventory::Yaml tests in preparation for adding ↵Paul Berry2011-02-171-21/+9
| | | | | | | | | | | | | | | | freshness check
* | | | (#5132) Provide a query REST interface for inventoryPaul Berry2011-02-174-6/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This REST interface returns a list of nodes that match a fact query. Fact queries can use (in)equality testing as a string comparison, and >, <, >=, <= numerical comparisons. Multiple tests can be done as AND comparisons, not OR. The fact queries need to be prefixed by facts, and the comparisons other than equality are specified with a .comparison_type after the fact name. This will be better explained in the REST documentation on the website. Searches that don't match anything now return empty array instead of a 404 error. Conflicts: spec/spec_helper.rb
* | | | (#6346) Move the trap calls onto Signal so they're easier to stubMatt Robinson2011-02-165-18/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once you stub signal traps in tests, you can hit ctrl+c in the middle of a spec run and it will stop the run instead of puppet catching the SIGINT. I had trouble easily tracking down all the places to stub traps when the trap was being called as a private method on applications and daemons, but calling trap on Signal is equivalent since Kernel calls Signal.trap and Object mixes in Kernel to provide trap as a private method on all objects. A bigger solution would be to refactor everywhere we call trap into a method that's called consistently since right now we sprinkle SIGINT and SIGTERM trap handling over applications and daemons in inconsistent ways, returning different error codes and using different messages. I've captured this info in ticket #6345. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | | | 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>
* | | | | (#5977) fix spec test failure when new applications are introduced.Daniel Pittman2011-02-121-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test here was previously fragile, in that it would break when new applications were introduced, and in that it depended on the order of items returned from reading the directories on disk. It is now insensitive to those changes, and still verifies that the results we require occur, reducing long term maintenance cost. Reviewed-by: James Turnbull <james@puppetlabs.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.
* | | | | Merge branch 'masterzen/tickets/2.6/5720' into ↵Daniel Pittman2011-02-123-3/+58
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | bug/2.6.next/5720-puppetdoc-fails-on-parameterized-class
| * | | | 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>
| * | | | Fix #6281 - Make sure puppetdoc analyzes all filesBrice Figureau2011-02-111-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can happen that when parsing a file puppet parses other manifests if they get imported (this is at least true for site.pp, even in ignoreimport=true). Thus those files are now "watched". But puppetdoc needs to analyze all files, and since 99c101 we are now checking if the file was already parsed to not reparse it again. If that was the case, though, we weren't analyzing the produced code. Thus it was possible to not produce documentation for the site.pp content. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | | Fix #6280 - puppetdoc crashing on string interpolationBrice Figureau2011-02-111-3/+3
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge remote branch 'dan/ticket/2.6.4/5977' into 2.6.nextJesse Wolfe2011-02-081-0/+24
|\ \ \ \ | |/ / / |/| | |
| * | | (5977) Puppet::Applications can be loaded from multiple paths.Dan Bode2011-01-141-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - previously, Puppet would search $LOAD_PATH and just load applications in the first $LOAD_PATH to have the directory puppet/application. Now multiple paths can contain applications.
* | | | (#5823) run mode can now be set dynamically...Daniel Pittman2011-02-031-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Third party scripts, and complex command line tools, depend on being able to configure the run_mode value at runtime, not just when they fire up. For better or worse we used to allow this sort of thing to work, but stopped, and we have no sane, safe and consensual alternative, so we broke a bunch of client code. This enables the feature again, but does not add any safety catch; you can now happily slice off your own feet with this, if you really want to.
* | | | (#4139) hook log autoflush into global defaultsDaniel Pittman2011-02-032-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We previously had an ordering dependency in the autoflush option, which was statically read from defaults when the log destination was configured. We add a hook in the defaults to update the log subsystem, which in turn updates log destinations, when autoflush is changed. This would work as desired: puppet agent --autoflush --logdest=file This would not work, as autoflush would be false: puppet agent --logdest=file --autoflush Now those changes propagate correctly. Paired-with: matt@puppetlabs.com
* | | | Merge branch '2.6.next' of git://github.com/puppetlabs/puppet into 2.6.nextMarkus Roberts2011-02-013-2/+29
|\ \ \ \
| * \ \ \ Merge remote branch 'bodepd/feature/2.6.4/5910' into 2.6.nextPaul Berry2011-02-011-0/+8
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * bodepd/feature/2.6.4/5910: (#5910) Improved logging when declared classes cannot be found:
| | * | | | (#5910) Improved logging when declared classes cannot be found:Dan Bode2011-01-121-0/+8
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when a class could not be found, it was displaying the same error message as when a resource type could not be found. This resulted in confusing error message: Invalid resource type class, when really it should display the name of the class that could not be found. My patch changes the error message to: Could not find declared class #{title}
| * | | | Merge branch 'ticket/2.6.x/5913' of git://github.com/mitchellh/puppet into ↵Jacob Helwig2011-02-011-0/+19
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2.6.next * 'ticket/2.6.x/5913' of git://github.com/mitchellh/puppet: (#5913) Fix Puppet::Application.find constant lookup behavior
| | * | | | (#5913) Fix Puppet::Application.find constant lookup behaviorMitchell Hashimoto2011-01-161-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Puppet::Application.find now only looks in the Puppet::Application namespace for the given constant.
| * | | | | Merge remote branch 'james/tickets/2.6.x/5916' into 2.6.nextJesse Wolfe2011-02-011-2/+2
| |\ \ \ \ \
| | * | | | | Fixes #5916 - Cleanup of unused doc methods and documentationJames Turnbull2011-01-171-2/+2
| | |/ / / /
* | | | | | Augmentation of tests for prior commitMarkus Roberts2011-02-011-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | There is no good answer to tests that depend on the order of itteration over hashes.
* | | | | | Fix to fix for #5755 -- backref serialization issues in zamlMarkus Roberts2011-02-011-1/+25
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit addresses the original issue that the change reverted in the previous commit for #5755 was intended to fix by removing the special case on labels in emit (lables, even if they are never generated, are not "new lines" and thus @recent_nl should always be set to false when one is emitted). It also partially addresses a related issue wherein temporary strings generated when field names are constructed recycle their object_id (they are temporary) and thus cause incorrect back references. This commit "fixes" the problem by never generating backrefs to strings (treating them as immutable). It does not address other suspected issues such as thread safety durring serialization due to the use of class variables to store the seen-object hash or the use of object ids as "permanently unique" identifiers. Paired with: Daniel Pittman Advice & Commiseration: Jesse Wolfe
* | | | | Merge branch 'feature/master/5061' into 2.6.nextPaul Berry2011-02-011-0/+22
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * feature/master/5061: (#5061) - allow special hostclass/define variables to be evaluated as defaults.
| * | | | | (#5061) - allow special hostclass/define variables to be evaluated as defaults.Dan Bode2011-02-011-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have always been annoyed that special variables for defines and hostclasses can not be evaluated as param defaults. Special variables are: $name, $title, $module_name. Code example: class x ( foo = $name ) { notice($foo)} should print x, and with my patch, it does. Reviewed-by: Paul Berry <paul@puppetlabs.com>
* | | | | | Merge branch 'ticket/2.6.next/5045' into 2.6.nextMatt Robinson2011-02-012-9/+118
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-242-33/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | | | (#5045) Adds support to resource/type to also accept a param hashDan Bode2011-01-241-0/+25
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The params are added as attributes when the resource is created. Also, even if the class already exists, if params are passed, we still try to create it. Reviewed-by: Matt Robinson
* | | | | Merge branch 'ticket/2.6.next/6107' into 2.6.nextMatt Robinson2011-02-012-0/+61
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * ticket/2.6.next/6107: (#6107) Fix an error when auditing a file with empty content
| * | | | | (#6107) Fix an error when auditing a file with empty contentMatt Robinson2011-02-012-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The manifest: file { "/tmp/foo" : ensure => present, audit => content, } produced the error: err: /Stage[main]//File[/tmp/foo]/ensure: change from absent to present failed: Could not retrieve content for from filebucket: private method `sub' called for nil:NilClass at /Users/matthewrobinson/work/puppet/test.pp:4 This was due to logic in content assuming that if you didn't specify content while you were auditing it you must have specified a source. The code paths in the file type badly need a cleanup so that these sorts of errors aren't so difficult to track down and things are easier to test. Paired-with: Daniel Pittman
* | | | | | Remove already initialized constant warning from file_spec.rb testsJacob Helwig2011-02-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rspec pulls constants from the implementation into the test, so we don't need to redefine it. Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
* | | | | | (#5566) Treat source only File checksums as syntax errors when used with contentJacob Helwig2011-02-011-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain checksum types (ctime, mtime) only make sense when used with the 'source' File parameter, since there is no way to check them on raw strings. Given the limitations of the current checksumming implementations, it is likely to introduce unexpected behavior when using the 'none' checksum type and either one of the 'source', and 'content' File parameters. Because of this, it is now a syntax error to use a checksum of 'none' with either parameter. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* | | | | | Remove order dependency when specifying source and checksum on File typeJacob Helwig2011-02-011-0/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If source was specified after setting the checksum, it would cause the checksum to be set back to :md5. This was completely unnecessary, because the checksum has its own default of :md5. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* | | | | Bug #5755 -- ZAML generates extra newline in some hash backreferences.Daniel Pittman2011-01-311-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This data structure generates YAML with an extra newline that violates the syntax rules and all: list = [1] { :a => list, :b => list }.to_yaml This breaks real client use of the YAML catalogs, not to mention our own use of cached catalogs...
* | | | | Spec for #5681 to allow parsing of AIX mount output in mount providerRick Bradley2011-01-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | This also adds a fixture file containing the AIX mount output as submitted by the ticket author.