summaryrefslogtreecommitdiffstats
path: root/spec/unit/indirector
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '2.7.x'Nick Lewis2011-08-2418-74/+4
|\ | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/feature/base.rb lib/puppet/file_serving/configuration.rb spec/unit/indirector/ssl_file_spec.rb spec/unit/parser/functions/extlookup_spec.rb spec/unit/resource/catalog_spec.rb test/language/ast/variable.rb
| * maint: Stub spec test so directory is not created unnecessarilyJosh Cooper2011-08-221-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the spec tests required that the parent directory (in this case /tmp) already exist and that /tmp/my_directory could be created. This fails on Windows as /tmp likely doesn't exist, and also the test doesn't actually need to create the directory. This commit forces the call to exists? with the parent directory to return true, and stubs the mkdir call so that the directory is not actually created. It also makes the raise_error expectation look for the specific error message, instead of a generic DevError.
| * Disable file bucket diffing tests on WindowsJacob Helwig2011-08-191-1/+1
| | | | | | | | | | | | | | | | The diffing ability of the file bucket is purely master functionality, and not supported on Windows. Reviewed-by: Nick Lewis <nick@puppetlabs.com> (cherry picked from commit 660ea963ddc5c74a758f6d52384ea40a8d335c58)
| * (#8663) Reenable spec tests on Windows that now passJosh Cooper2011-08-191-1/+1
| | | | | | | | | | | | | | | | | | The cacher was causing spec tests to fail due to Time.now not having millisecond resolution on Windows. Now that usage of the cacher has been removed from many places, these tests now pass. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 9e502ed121847fe4fcca90453c0520b53103d17d)
| * Update certificate spec tests for WindowsJosh Cooper2011-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable CA related spec tests on Windows, since that functionality is not supported. Some cert spec tests are still marked as fails_on_windows because settings attempts to create and apply a catalog corresponding to ssl/cert related directories. This fails because on Windows Puppet.features.root? always returns true (which is a separate bug), and as a result attempts to set the owner and group, which fails because the provider is not implemented yet on Windows. Also many of these tests were using Tempfile.new and trying to system("rm -rf ...") later. I changed these to use PuppetSpec::Files.tmpdir instead, which automatically cleans up temporary directories after the tests have run. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 95837e6d3e74648617c308aedc52192bb13fde5a)
| * Rework Puppet::Util::Cacher to only expire using TTLsNick Lewis2011-08-191-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have removed every usage of cached_attr in which the attribute needs to be manually expired. Thus, the only meaningful behavior provided by Puppet::Util::Cacher is expiration based on TTLs. This commit reworks the cacher to only support that behavior. Rather than accepting an options hash, of which :ttl is the only available option, cached_attr now requires a second argument, which is the TTL. TTLs are now used to compute expirations, which are stored and used for expiring values. Previously, we stored a timestamp and used it and the TTL to determine whether the attribute was expired. This had the potentially undesirable side effect that the lifetime of a cached attribute could be extended after its insertion by modifying the TTL setting for the cache. Now, the lifetime of an attribute is determined when it is set, and is thereafter immutable, aside from deliberately re-setting the expiration for that particular attribute. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit d198fedf65e472b384666fc9ae3bef487852068a) Conflicts: spec/integration/node/facts_spec.rb spec/unit/node_spec.rb
| * Remove use of Util::Cacher in FileServing::ConfigurationNick Lewis2011-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | This class was using Util::Cacher for its singleton instance, when that was unnecessary. The FileServing::Configuration instance already manages whether or not to reparse its config file, based on whether it has changed. Thus, there is no need for it to be manually expired via the cacher. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 4bad729f56c26d8154cd0f20614fa4e478de9d40)
| * Maint: Tagged spec tests that are known to fail on WindowsJosh Cooper2011-08-195-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many spec tests fail on Windows because there are no default providers implemented for Windows yet. Several others are failing due to Puppet::Util::Cacher not working correctly, so for now the tests that are known to fail are marked with :fails_on_windows => true. To skip these tests, you can run: rspec --tag ~fails_on_windows spec Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 255c5b4663bd389d2c87a2d39ec350034421a6f0) Conflicts: spec/unit/resource/catalog_spec.rb
| * Fix tests with "relative" paths on WindowsJosh Cooper2011-08-192-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows, which breaks many test cases. This commit adds a method to PuppetSpec::Files.make_absolute that makes the path absolute in test cases. On Unix (Puppet.features.posix?) it is a no-op. On Windows, (Puppet.features.microsoft_windows?) the drive from the current working directory is prepended. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 462a95e3d077b1915a919399b846068816c84583) Conflicts: spec/unit/parser/functions/extlookup_spec.rb
| * (#8489) Consistently use File::PATH_SEPARATORJosh Cooper2011-08-191-1/+1
| | | | | | | | | | | | | | | | | | Puppet uses both colon and File::PATH_SEPARATOR in various places, which does not work on Windows, where File::PATH_SEPARATOR is a semi-colon. This commit changes the code and tests to consistently use File::PATH_SEPARATOR. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 26ee468e8b963d63933d9a27a65d55510ff87618)
| * maint: remove inaccurate copyright and license statements.Daniel Pittman2011-08-1818-72/+0
| | | | | | | | | | | | | | | | | | | | | | For a while Luke, and other authors, injected a created tag, copyright statement, and "All rights reserved" into every new file they added to the Puppet project. This isn't really true, and we have a global license covering the code, so we have now stripped out all those old tags. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
* | Merge branch '2.7.x'Matt Robinson2011-08-152-3/+42
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.7.x: (25 commits) (#4411) Explain that runinterval = 0 does not mean "never run" Maint: Fix missing option text in puppet agent and arrange options alphabetically (#8302) Improve documentation of exec providers (#7853) Clarify and complete docs for the tagmail report processor Maint: Mention that audit metaparameter will accept "all" Maint: Adjust wording for file type's content parameter Maint: Fix poor documentation for versioncmp function. maint: Fix case sensitive require maint: Add inspect app options to help maint: Fix inspect help Increment lib/puppet.rb VERSION string Updated CHANGELOG for 2.7.3rc1 (#4762) Ensure that clients on the moon can successfully connect. Add document outlining preferred contribution methods Add document outlining preferred contribution methods Add document outlining preferred contribution methods Revert "Merge branch 'vcsrepo'" Revert "Merge branch 'vcsrepo'" Updating CHANGELOG for 2.7.2rc3 (#8704) Give better errors for invalid fileserver.conf ... Manually Resolved Conflicts: lib/puppet/parser/functions/versioncmp.rb spec/integration/node/facts_spec.rb
| * (#1886) Clean up `node clean` for merge.Pieter van de Bruggen2011-07-281-1/+1
| | | | | | | | | | This includes various style changes, and assorted fixes to testing. Paired-With: Matt Robinson
| * Fix #1886 - Add node cleanup capabilityPeter Meier2011-07-272-3/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here is a changeset that adds a new action to the puppet node face. This application removes all traces of a node on the puppetmaster (including certs, cached facts and nodes, reports, and storedconfig entries). Furthermore it is capable of unexporting exported resources of a host so that consumers of these resources can remove the exported resources and we will safely remove the node from our infrastructure. Usage: puppet node clean [--unexport] <host> [<host2> ...] To achieve this we add different destroy methods to the different parts of the indirector. So for example for yaml indirections we already offer read access for the yaml, this changeset adds the destroy handler which only removes the yaml file for a request. This can be used to remove cached entries. This work is based on the initial work of Brice Figureau <brice-puppet@daysofwonder.com>
* | Disable file bucket diffing tests on WindowsJacob Helwig2011-08-021-1/+1
| | | | | | | | | | | | | | The diffing ability of the file bucket is purely master functionality, and not supported on Windows. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | Merge branch 'ticket/master/8663-windows-spec-tests'Josh Cooper2011-07-271-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | * ticket/master/8663-windows-spec-tests: (#8663) Drive letters are not valid absolute paths on Windows (#8663) Update the run_mode spec test on Windows to match the code (#8663) The ssh_authorized_key type is not supported on Windows (#8663) Reenable spec tests on Windows that now pass
| * | (#8663) Reenable spec tests on Windows that now passJosh Cooper2011-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The cacher was causing spec tests to fail due to Time.now not having millisecond resolution on Windows. Now that usage of the cacher has been removed from many places, these tests now pass. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | | Merge branch 'master' of github.com:puppetlabs/puppetJosh Cooper2011-07-261-36/+47
|\ \ \ | |/ / |/| | | | | | | | | | | * 'master' of github.com:puppetlabs/puppet: maint: Suggest where to start troubleshooting SSL error message maint: Fix cert app to print help and exit if no subcommand
| * | Merge branch '2.7.x'Matt Robinson2011-07-261-36/+47
| |\| | | | | | | | | | | | | | | | * 2.7.x: maint: Suggest where to start troubleshooting SSL error message maint: Fix cert app to print help and exit if no subcommand
| | * maint: Suggest where to start troubleshooting SSL error messageMatt Robinson2011-07-261-36/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Much like the infamous "hostname was not match" error message, there's another SSL error that people run into that isn't clear how to troubleshoot. err: Could not send report: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed. As far as I can tell this only ever happens when the clock is off on the master or client. People seem to think it will happen other times, but I haven't been able to reproduce it other ways - missing private key, revoked cert, offline CA all have their own errors. I googled around and the only thing I've seen for this error in relation to puppet is the time sync problem. So the error message text just has some additional info to suggest you check your clocks. Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | | Update certificate spec tests for WindowsJosh Cooper2011-07-261-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable CA related spec tests on Windows, since that functionality is not supported. Some cert spec tests are still marked as fails_on_windows because settings attempts to create and apply a catalog corresponding to ssl/cert related directories. This fails because on Windows Puppet.features.root? always returns true (which is a separate bug), and as a result attempts to set the owner and group, which fails because the provider is not implemented yet on Windows. Also many of these tests were using Tempfile.new and trying to system("rm -rf ...") later. I changed these to use PuppetSpec::Files.tmpdir instead, which automatically cleans up temporary directories after the tests have run. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | Merge branch '2.7.x'Nick Lewis2011-07-252-6/+10
|\| | | | | | | | | | | Conflicts: lib/puppet/type/file/source.rb spec/unit/resource/catalog_spec.rb
| * Merge branch '2.6.x' into 2.7.xNick Lewis2011-07-251-5/+7
| |\
| | * maint: Add debug logging when the master receives a reportMatt Robinson2011-07-251-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | It's always bothered me that when running puppet inspect (or any application that produces a report really) the master gives no indication that anything happened when it processes the report. Reviewed-by: Max Martin <max@puppetlabs.com>
| * | (#7290) Update indirected Faces to avoid unknown options.Daniel Pittman2011-07-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we enforce that options must be declared, the model we exposed in the Ruby API (but not the CLI facade) was that you could pass additional arguments to the indirection method by passing them as unknown options doesn't work. Instead, explicitly declare an option, `extra`, that accepts the final argument to be passed direct to the indirection. This makes things work smoothly, as well as making it possible (once you can input a hash on the command line) to invoke extra arguments from the facade too... Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
* | | Rework Puppet::Util::Cacher to only expire using TTLsNick Lewis2011-07-211-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have removed every usage of cached_attr in which the attribute needs to be manually expired. Thus, the only meaningful behavior provided by Puppet::Util::Cacher is expiration based on TTLs. This commit reworks the cacher to only support that behavior. Rather than accepting an options hash, of which :ttl is the only available option, cached_attr now requires a second argument, which is the TTL. TTLs are now used to compute expirations, which are stored and used for expiring values. Previously, we stored a timestamp and used it and the TTL to determine whether the attribute was expired. This had the potentially undesirable side effect that the lifetime of a cached attribute could be extended after its insertion by modifying the TTL setting for the cache. Now, the lifetime of an attribute is determined when it is set, and is thereafter immutable, aside from deliberately re-setting the expiration for that particular attribute. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
* | | Remove use of Util::Cacher in FileServing::ConfigurationNick Lewis2011-07-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This class was using Util::Cacher for its singleton instance, when that was unnecessary. The FileServing::Configuration instance already manages whether or not to reparse its config file, based on whether it has changed. Thus, there is no need for it to be manually expired via the cacher. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
* | | Merge branch '2.7.x'Nick Lewis2011-07-201-0/+4
|\| |
| * | Fix order-dependent test failure in certificate_status/file specNick Lewis2011-07-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test was failing if the SSL indirections had previously been configured as :ca. The was due to the fact that we are explicitly testing the certificate_status :file terminus, which depends on the other SSL indirections using corresponding termini. This spec wasn't appropriately ensuring they were also set to :file, breaking that precondition, and causing failures. Reviewed-By: Matt Robinson <matt@puppetlabs.com>
* | | Maint: Tagged spec tests that are known to fail on WindowsJosh Cooper2011-07-195-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many spec tests fail on Windows because there are no default providers implemented for Windows yet. Several others are failing due to Puppet::Util::Cacher not working correctly, so for now the tests that are known to fail are marked with :fails_on_windows => true. To skip these tests, you can run: rspec --tag ~fails_on_windows spec Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | | Fix tests with "relative" paths on WindowsJosh Cooper2011-07-192-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows, which breaks many test cases. This commit adds a method to PuppetSpec::Files.make_absolute that makes the path absolute in test cases. On Unix (Puppet.features.posix?) it is a no-op. On Windows, (Puppet.features.microsoft_windows?) the drive from the current working directory is prepended. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | | (#8489) Consistently use File::PATH_SEPARATORJosh Cooper2011-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Puppet uses both colon and File::PATH_SEPARATOR in various places, which does not work on Windows, where File::PATH_SEPARATOR is a semi-colon. This commit changes the code and tests to consistently use File::PATH_SEPARATOR. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* | | (#7080) Registering PSON document typesLuke Kanies2011-07-151-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | We were originally using the actual constant for both Indirector Requests and Nodes, and this registers their document types as symbolic names. Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | | Switching to use of json matchersLuke Kanies2011-07-151-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is only in the Node and Indirection::Request code. It makes the tests much simpler. Signed-off-by: Luke Kanies <luke@puppetlabs.com> Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* | | (7080) Adding json support to Indirector RequestLuke Kanies2011-07-151-0/+99
|/ / | | | | | | | | | | | | | | We'll be using this to do RPC over mcollective. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com> Reviewed-by: Nick Lewis <nick@puppetlabs.com> Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* | (#7224) Reword 'hostname was not match' error messageNick Lewis2011-06-142-5/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This error message is grammatically incorrect and unhelpful, so we replace it with a message that explains more correctly what went wrong and what was expected. This message happens when making an authenticated connection to a server where the certificate doesn't match its hostname. This happens in the REST terminuses, so we wrap their HTTP methods with a helper that will catch the appropriate SSLError and re-raise it with the better message stating the hostname used, and the list of hostnames that we were expecting it to be a part of. Unfortunately, because the certificate in question isn't available at error time, we have to use the Net::HTTP#verify_callback to capture it. Paired-With: Jacob Helwig <jacob@puppetlabs.com> Reviewed-By: Dominic Maraglia <dominic@puppetlabs.com>
* | (#7690) Don't blow up when listing terminuses available for facesMatt Robinson2011-05-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, in order to list the available terminuses for an indirected face we loaded all the the terminuses in order to list them. This meant that if a terminus like active_record didn't have the dependencies it needed, the documentation would raise errors and not list terminuses. <Puppet::Error: Could not autoload filename uninitialized constant Object::ActiveRecord> Now we just list the terminuses available in the load path without trying to load them. The terminus will still raise an error if you try to use it without its dependencies being met. Paired-with: Max Martin <max@puppetlabs.com>
* | (#7507) Add more 1.9 filtersJosh Cooper2011-05-201-2/+2
| | | | | | | | | | | | Additionally we fixed a scoping issue with the File type. Paired-With: Matt Robinson <matt@puppetlabs.com>
* | Merge branch '2.6.x' into 2.7.nextPieter van de Bruggen2011-05-182-5/+5
|\|
| * (#3836) External nodes should only capture stdoutOliver Hookins2011-05-132-5/+5
| | | | | | | | This patch prevents stdout and stderr from being combined by Puppet::Util.execute, when used by Puppet::Indirector::Exec for external nodes.
| * Fixed #7166 - Replaced deprecated stomp "send" method with "publish"James Turnbull2011-04-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | The "send" method in the stomp gem has been deprecated since: http://gitorious.org/stomp/mainline/commit/d542a976028cb4c5badcbb69e3383e746721e44c It's been replaced with the "publish" method. Also renamed the send_message method to publish_message more in keeping with language used in queuing.
| * maint: Fix sqlite3 require to really be optionalMatt Robinson2011-04-111-1/+4
| | | | | | | | | | | | | | You need to specifically rescue LoadError if you want requires to be optional. Paired-with: Nick Lewis
| * maint: Fix sporadic sqlite errorMatt Robinson2011-04-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord::StatementInvalid: SQLite3::IOException: disk I/O error This happened if you ran these tests in the following order since Rails wasn't disconnecting between tests. rspec spec/unit/indirector/facts/inventory_active_record_spec.rb spec/unit/indirector/node/active_record_spec.rb Paired-with: Nick Lewis <nick@puppetlabs.com>
| * Fix #4339 - Locally save the last report to $lastrunreportBrice Figureau2011-04-051-0/+38
| | | | | | | | | | | | | | | | Using the cache terminus system, when --report is on, we are now caching the last report as a yaml file in the $lastrunreport file (which by default is $statedir/last_run_report.yaml). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | maint: fix spec_helper inclusions again.Daniel Pittman2011-05-171-6/+2
| | | | | | | | | | | | | | | | | | | | We got rid of the '../../spec_helper' style requires, but a few of them snuck back in in recent changes. This purges them out, replaced with the header: #!/usr/bin/env rspec require 'spec_helper' Reviewed-By: Nick Lewis <nick@puppetlabs.com>
* | Merge branch '2.7.x' into 2.7.nextPieter van de Bruggen2011-05-175-9/+9
|\ \
| * | (#7507) Add more filters for Ruby 1.9 spec failuresPieter van de Bruggen2011-05-171-1/+1
| | | | | | | | | Paired-With: Matt Robinson
| * | (#7507) Add ability to filter Ruby 1.9 spec failuresMatt Robinson2011-05-175-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By running: rspec spec --tag ~@fails_on_ruby_1.9.2 We can now just run the specs that pass under Ruby 1.9. Obviously in the long term we want to have all the specs passing, but until then we need notification when we regress. From now on new code will be required to pass under Ruby 1.9, and Jenkins will give us email notification if it doesn't or if we break something that was already working. Reviewed-by: Daniel Pittman <daniel@puppetlabs.com>
* | | (#7259) Remove ActiveRecord requirement from indirector face specJacob Helwig2011-05-161-2/+11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "should be able to return a list of terminuses for a given indirection" was calling Puppet::Indirector::Face.terminus_classes, which is just a thin wrapper around Puppet::Indirector::Terminus.terminus_classes, which would attempt to load all Terminus classes. This would cause problems if not all of the prerequisites for all of the Terminus classes were installed (For example: ActiveRecord). Now we only test that the thin wrapper appropriately munges the output from Puppet::Indirector::Terminus.terminus_classes, since the method being wrapped should have its own tests for the behavior that was being tested originally. Paired-with: Nick Lewis <nick@puppetlabs.com>
* | maint: move the indirector face base out of puppet/faceDaniel Pittman2011-05-021-0/+59
| | | | | | | | | | | | | | | | | | We used to shove the base class Puppet::Face::Indirector next to the actual faces; this made a bunch of things, including testing, confusing. Instead, move it away into the indirector where it lives with the rest of the indirector related things. Reviewed-By: Nick Lewis <nick@puppetlabs.com>