summaryrefslogtreecommitdiffstats
path: root/spec/unit
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Merge branch 'ticket/next/5274' into nextNick Lewis2010-11-172-0/+279
|\ \ \ \
| * | | | (#5274) New tests for new hosttype/parsedproviderStefan Schulte2010-11-172-3/+45
| | | | | | | | | | | | | | | | | | | | | | | | | Just a few additional tests for the new property "comment" of the host type.
| * | | | (#5274) Tests for hostprovider removes commentsStefan Schulte2010-11-172-0/+237
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed that the hostprovider will remove all inline comments from the /etc/hosts file, when puppet updates at least one entry. Puppet will also remove comments from entries, the user doesnt want to manage with puppet. To split up changes a bit this commit will only introduce tests for the host type and the hostprovider. A few will fail, indicating the bug: The hostprovider parses all entries and builds a hash. When building the recordhash all comments are discarded. When puppet has to update at least one entry it uses the to_line function to convert the record hash back to a file. Because the comments are not stored in the hash, they cannot be written back to the file.
* | | | Merge commit '2.6.3' into nextPaul Berry2010-11-1719-154/+285
|\| | | | | | | | | | | | | | | | | | | | | | | Resolved conflicts manually: spec/integration/indirector/bucket_file/rest_spec.rb spec/integration/indirector/certificate_revocation_list/rest_spec.rb
| * | | Fix for #4279 -- mount detection on HP-UXMarkus Roberts2010-11-161-1/+8
| | | | | | | | | | | | | | | | | | | | This is based on the discussion on ticket, simplified slightly and with test adjustment.
| * | | 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-164-13/+13
| | | |
| * | | (#5297) Fix schedule tests that were missing stubs for Time.nowMatt Robinson2010-11-161-0/+4
| | | | | | | | | | | | | | | | Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
| * | | Fix for #4299 -- Don't require whichMarkus Roberts2010-11-122-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | We already had an internal implementation of which hiding under an assumed name (Puppet::Util.binary); this commit calls it out of hiding and uses it consisantly.
| * | | Fix #5020 - Prefer finding node name from REST uri over certnameBrice Figureau2010-11-121-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a behavior change. Before this patch, we always used the currently connected node's certname to compile the catalog, despite the value of the catalog URI REST request. With this patch we now use the URI as the compiled node name. This is safe because the default auth.conf (and default inserted rules when no auth.conf is present) only allow the given connected node to compile its own catalog. But this also allows for greater flexibility with auth.conf. For instance it can be used by a monitoring system to check multiple nodes catalogs with only one certificate: path ~ ^/catalog/([^/]+)$ method find allow $1 allow monitoring-station.domain.com Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | Fix for #4955 -- Race condition & memory leak in Puppet::UtilMarkus Roberts2010-11-123-39/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Puppet::Util.sync method was not thread safe and also leaked memory. I'm not certain, but I believe the first is ironic and the second is merely a bug. This patch addresses the problem by 1) refactoring so the sync objects are never returned (and thus no one can cache a reference to one) 2) adding reference counting 3) deleting them when they are no longer needed 4) doing the thread safty dance. It wasn't the first (or even second) solution considered, but it's the one that I was able to make work in a way that I'm convinced is correct. Its main advantage is that it puts all the tricky bits in one place.
| * | | 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 for #2568 -- Add a dbconnections option to set AR pool sizeMarkus Roberts2010-11-101-0/+74
| | | | | | | | | | | | | | | | | | | | The dbconnection option, if set to a positive integer, will be passed to active record as the connection pool size (pool).
| * | | Maint. Removing code for which no CLA has been signedMarkus Roberts2010-11-101-22/+8
| | | | | | | | | | | | | | | | | | | | Multiple attemps were made to contact the author of this code in order to obtain a Contributor Licence Agreement, but we were unable to do so.
| * | | Fix #4923 - close process race when truncating existing fileBrice Figureau2010-11-101-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using File.open(file, "w") calls open(2) with O_CREAT|O_TRUNC which means when the file exists it is immediately truncated. But the file is not locked yet, so another process can either write or read to the file, leading to file corruption. The fix is to truncate only when the file is exclusively locked. This can be done on some operating system with O_EXLOCK open(2) flag. I chose the more portable option of: * open * flock * truncate * write * close It might also be good to flush and fsync the file after writing it, otherwise in case of crash an incomplete file can stay on disk. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | | (#4573) FreeBSD service provider now supports versions <7 and >8Nick Lewis2010-11-101-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running "/etc/rc.d/SERVICE rcvar" outputs different formats for different versions of FreeBSD. This patch adds support for those formats, as well as tests. Based on patches from: o Joost van Beurden o Russell Jackson Paired-With: Matt Robinson
| * | | Fix #3808 - puppetdoc should use --force-update only if RDoc supports itBrice Figureau2010-11-101-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | This should allow to run puppetdoc on ruby 1.8.5. 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>
| * | | (#5242) Fix schedule specs that fail near daylight savingsMatt Robinson2010-11-101-43/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I fixed a few of these in a previous patch, but Hudson found more. I replaced the pattern of using Time.now and then doing date math to calculate intervals with the pattern of hard setting the intervals using utc times for the test. Reviewed-by: Paul Berry <paul@puppetlabs.com>
| * | | [#5225] Fix spec failure that depended on time changeMatt Robinson2010-11-081-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turns out that: zero = Time.now # Reset the current time to X:00:00 current = zero - (zero.hour * 3600) - (zero.min * 60) - zero.sec current is actually 1am on a day where the time falls back (Nov 7th), not midnight as the test expected. Reviewed-by: Paul Berry <paul@puppetlabs.com>
| * | | (#5233) Randomize tmp dir pathsMatt Robinson2010-11-083-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Standardize how we create tmpdirs by using the puppet function instead of Dir.tmpdir. Paired-with: Paul Berry <paul@puppetlabs.com>
* | | | Merge branch 'ticket/next/4590' into nextMarkus Roberts2010-11-174-24/+257
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/util/monkey_patches.rb -- two unrelated additions had been made, kept them both.
| * | | | [#4590] SimpleGraph is slowPaul Berry2010-10-074-24/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrote SimpleGraph to use a more efficient internal representation. To preserve compatibility with older clients, graphs are still serialized to YAML using the format used by Puppet 2.6. However, a newer, more compact format can be enabled by setting "use_new_yaml_format" to true. Deserialization from YAML accepts either the old 2.6 format or the newer format. In a later release, once we no longer need to be compatible with 2.6, we will be able to switch to the new format. To make deserialization accept multiple formats, it was necessary to use the yaml_initialize method. This method is not supported in versions of Ruby prior to 1.8.3, so a monkey patch is included to add support for it to Ruby 1.8.1 and 1.8.2. Thanks to Markus Roberts for the SimpleGraph rewrite. Thanks to Jesse Wolfe for figuring out how to write the yaml_initialize monkey patch.
* | | | | Merge branch 'feature/next/3747' into nextNick Lewis2010-11-111-0/+50
|\ \ \ \ \
| * | | | | (#3747) Add specs for upstart providerNick Lewis2010-11-111-0/+50
| | |_|/ / | |/| | | | | | | | | | | | | Paired-With: Matt Robinson
* / | | | Fix #4904 Mounts shouldn't remount unless they are ensure=>mountedJesse Wolfe2010-11-111-5/+27
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After we fixed issue #2730, it is now possible to manage an fstab entry without asking puppet to try to call mount or unmount on that device. That fix failed to address the "refresh" behavior of mounts. We have changed "refresh" to only remount devices that are set to "mounted", so users can truly manage fstab entries without having puppet try to remount them. Paired-With: Paul Berry <paul@puppetlabs.com>
* | | | Merge branch 'feature/master/5198' into nextPaul Berry2010-11-091-1/+2
|\ \ \ \
| * | | | (#5198) Added a spec test for new TB unitPaul Berry2010-11-091-1/+2
| | | | |
* | | | | Merge remote branch 'jamtur01/tickets/2.6.x/5108' into nextPaul Berry2010-11-091-0/+4
|\ \ \ \ \
| * | | | | Fixed to #5108 - Change default of service hasstatus property to trueJames Turnbull2010-10-271-0/+4
| | | | | |
* | | | | | Merge commit '2.6.3rc2' into nextPaul Berry2010-11-094-117/+164
|\ \ \ \ \ \ | | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | Manually resolved conflicts: lib/puppet/parser/ast/resource.rb spec/unit/parser/ast/resource_spec.rb
| * | | | | (#4534/#4778) -- Normalize parameterized classesPaul Berry2010-10-273-109/+154
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Maint: remove unnecessary stubbing from agent_specPaul Berry2010-11-091-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | The agent spec tests were stubbing out all methods related to Puppet settings, making it difficult to keep these tests maintained. The tests now function by setting the settings in question.
* | | | Maint: Remove Indirector::Request objects from HTTP Handler and API V1Jesse Wolfe2010-11-024-138/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a maintenance refactor to reduce the dependencies between the rest API and the implementation of the Indirector. The HTTP Handler code was creating temporary Request objects that were not actually being passed to the Indirector.
* | | | (#5166) Inventory service is now searchable by timestamp.Paul Berry2010-11-011-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 Berry2010-11-011-21/+9
| | | | | | | | | | | | | | | | freshness check
* | | | Fix #5164 Change Facts timestamp when they are received by the masterJesse Wolfe2010-11-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch causes the puppet master to re-timestamp facts when they are received by the catalog compiler terminus. This makes the timestamps more trustworthy, as it means that they are all based upon the same clock's time. Paired-With: Paul Berry <paul@puppetlabs.com>
* | | | Maint: Don't use a stub for a Facts object in the compiler specsJesse Wolfe2010-11-011-1/+2
| | | | | | | | | | | | | | | | | | | | The catalog compiler spec was overstubbing the Node::Facts object, making it hard to test the interaction between those two systems.
* | | | Maint: spec/unit/indirector/catalog/compiler_spec.rb wouldn't run by itselfJesse Wolfe2010-11-011-0/+1
| | | | | | | | | | | | | | | | Require puppet/rails so we can run this test alone.
* | | | (#5132) Provide a query REST interface for inventoryMatt Robinson2010-10-284-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.
* | | | (#5148) Fix failing spec due to timezoneNick Lewis2010-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Time.parse(...) will yield a string in the local timezone. So when this spec was run in a non -0700 timezone, it was failing, because it was comparing a string in local time to a string in -0700. This fixes it to compare to the local string representation of the time.
* | | | (#5148) Add support for PSON to factsNick Lewis2010-10-281-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, facts could be fetched via the REST API in PSON, but came back as the to_s representation of a Ruby object, rather than as proper PSON data. This patch adds to_pson and from_pson to facts, so they can be properly used with PSON.
* | | | Merge commit '2.6.3rc1' into nextJesse Wolfe2010-10-183-1/+60
|\| | |
| * | | Fix for #4832 -- Making PSON handle arbitrary binary dataMarkus Roberts2010-10-131-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PSON library needlessly assumed that the data to be transmitted was well- formed unicode. This made Latin-1 users (and anyone who needed to serialize arbitrary binary data) sad. This patch goes some of the way to resolving the issues, by passing through non-unicode data rather than just failing, adds tests, and cleans up a pernicious assumption about escape characters in ruby regular expressions not marked "n" (no-encoding).
| * | | Minimal fix for #4975 -- only call chage when managing password age rulesMarkus Roberts2010-10-131-0/+42
| | | | | | | | | | | | | | | | | | | | This is intended to be a minimal fix, with tests, to prevent chage from running unless needed.
| * | | Fix for #4963 -- Use correct commands for password expiry on solarisMarkus Roberts2010-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | This fixes the command / option issues of #4963 as suggested on the ticket; the setting-expiry when not needed aspects are deferred to #4975.
* | | | Merge remote branch 'paul/ticket/next/4657' into nextJesse Wolfe2010-10-051-34/+22
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-022-22/+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-048-9/+105
|\ \ \ \ | | |/ / | |/| |