summaryrefslogtreecommitdiffstats
path: root/spec/unit/indirector/indirection.rb
Commit message (Collapse)AuthorAgeFilesLines
* [#3994] rename the specs to have _spec.rb at the endMarkus Roberts2010-06-231-795/+0
| | | | | | | | | Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
* {#3866] Rename the method metaclass to singleton_class to avoid the ↵Matt Robinson2010-02-171-1/+1
| | | | | | | | | | | | deprecation warnings from Rails ActiveSupport The metaid.rb file came straight from why the lucky stiff's "seeing metaclasses clearly" article. Rails used this too, but they recently deprecated the name metaclass in favor of singleton_class to match what ruby-core decided to do. meta, eigen and singlton class were all suggested and in the end singleton was agreed upon. http://redmine.ruby-lang.org/issues/show/1082
* Revert the guts of #2890Markus Roberts2010-02-171-28/+17
| | | | | | | | | | 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.
* REST: hide Request objectJesse Wolfe2010-02-171-2/+2
| | | | | | This change to the REST branch restores some sanity by explicitly allowing a destination URL for indirector save() calls, removing a hack that I was using to accomplish this.
* Feature #3347 REST-ified FileBucketJesse Wolfe2010-02-171-2/+2
| | | | | | | | | | | | | | | | FileBucket Files have been reimplemented as an indirector terminus so that they can be transmitted over REST. The old Network::Client.dipper has been replaced with a compatibility later in FileBucket::Dipper that uses the indirector to access filebucket termini. Slightly revised patch: * No longer allows nil contents in FileBucket outside of initialization * Uses File.exist? instead of the deprecated File.exists? * Tweaks JSON serialization and de-serialization to include "path" Deferred issues: * Feature #3371 "FileBucket should not keep files in memory". * Feature #3372 "Replace FileBucket Dipper with more idiomatic calls"
* Fix for #2890 (the cached certificates that would not die)Markus Roberts2009-12-191-18/+29
| | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the two-part suggestion from the ticket; 1) a client that receives a certificate that doesn't match its current private key does not accept, store or use the certificate--instead it removes any locally cached copies and acts as if the certificate had never been found. 2) a puppetmaster that receives a csr from a client for whom it already has a signed certificate now honors the request and considers it to supercede any previously signed certificates. In order to make the cache expiration work as expected, I changed a few assumptions in the caching system: * The expiration of a cached certificate is the earlier of the envelope expiration and the certificate's expiration, as opposed to just overriding the cache value * Telling the cache to expire an item now removes it from the cache if possible, rather than just setting an expiration date in the past and hoping that somebody notices. Signed-off-by: Markus Roberts <Markus@reality.com>
* Fix #2391 - Exported resources never make to the storeconfigs dbBrice Figureau2009-07-181-0/+8
| | | | | | | | | | | | | | | | | | The issue is that when we convert Puppet::Parser::Resource catalog to a Puppet::Resource catalog before storing it to the database, we don't allow virtual resource to be converted. Unfortunately exported resources are virtual by design, and as such aren't converted, and we lose them, so it isn't possible to store them in the database. Unfortunately, the client will get the exported resources too. The fix is dual-fold: * we make sure exported resource are skipped when the transaction is applied as a last safeguard * we filter-out the catalog through the catalog compiler terminus before the catalog is returned to the client Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Removed extra whitespace from end of linesIan Taylor2009-06-061-6/+6
|
* Adding better logging when cached indirection resources are usedLuke Kanies2009-04-221-1/+1
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Partially fixing #2029 - failed caches doesn't throw an exceptionLuke Kanies2009-04-171-0/+15
| | | | | | | If the main terminus fails you get an exception, but not if a cache terminus fails. Signed-off-by: Luke Kanies <luke@madstop.com>
* Changing how the Configurer interacts with the cacheLuke Kanies2009-02-061-3/+18
| | | | | | | | | This changes the hooks provided via the Indirector Request for determining how the cache is used. These hooks are only used by the Configurer class. They're messy, but I can't come up with a better design, and they're at least sufficient. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing (and testing) the return of Indirection#saveLuke Kanies2009-02-061-3/+13
| | | | | | | | This broke in a previous commit, and was apparently not tested well because of how the mocks were set up. The integration test caught it. Signed-off-by: Luke Kanies <luke@madstop.com>
* Allowing the Indirection cache to be reset to nilLuke Kanies2009-02-061-2/+3
| | | | | | Otherwise we couldn't disable a cache once configured. Signed-off-by: Luke Kanies <luke@madstop.com>
* Only caching saved resources when the main save worksLuke Kanies2009-02-061-1/+11
| | | | | | | This way you don't have data cached that couldn't be saved to the main repository. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding support for skipping cached indirection instances.Luke Kanies2009-02-061-1/+8
| | | | | | | This will allow the soon-to-be-created Agent class to skip cached catalogs when desired. Signed-off-by: Luke Kanies <luke@madstop.com>
* Changing the Cacher.invalidate method to Cacher.expire.Luke Kanies2008-11-111-2/+2
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Causing the Indirection to fail if a terminus selection hook does not return ↵Luke Kanies2008-08-261-0/+16
| | | | | | a value. Signed-off-by: Luke Kanies <luke@madstop.com>
* Merge branch '0.24.x'Luke Kanies2008-06-141-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also added the fixes to make the certhandler tests pass even when certs exist; I'll deal with the conflict later. Conflicts: CHANGELOG bin/puppetd lib/puppet/network/http/handler.rb lib/puppet/network/http/mongrel/rest.rb spec/integration/indirector/rest.rb spec/integration/network/server/mongrel.rb spec/integration/network/server/webrick.rb spec/unit/network/http/webrick.rb
| * Fixing how the indirection tests for whether the request has node info.Luke Kanies2008-06-111-4/+4
| | | | | | | | | | | | | | | | | | | | My request authorization code changed the request to set its 'node' instance variable, rather than using its options, and I apparently didn't change the Indirection class to do this. I have *no* idea how these tests were passing before -- they passed for me yesterday but failed for Andrew, and today they started failing for me. Frightening.
* | Using the new Cacher class for handling cached data.Luke Kanies2008-05-131-22/+4
|/ | | | | This provides a single, global bit for determining whether a given piece of cached data is still valid.
* The 'destroy' method in the indirection now returnsLuke Kanies2008-04-111-3/+3
| | | | | the results of destroying, so they can return true or false.
* Fixing the expire method (it wasn't using a requestLuke Kanies2008-04-101-8/+30
| | | | | | internally), and fixing the Facts class so it auto-expires any associated cached nodes when facts are saved.
* Moved the request creation into the IndirectionLuke Kanies2008-04-101-161/+209
| | | | | | class instead of the Indirector module. Also, added an 'expire' method to the indirector, so there's an easy way to expire cached instances.
* Intermediate commit.Luke Kanies2008-04-081-112/+103
| | | | | | | | | | | | | | | | | This commit adds a Request instance into the indirection, pushing it all the way to the terminus instances. It's a big commit because it requires modifying every terminus class. There are still some thorny design issues. In particular, who should be responsible for making the request object? I've tried having both the indirection class and the Indirector module creating it, and both have their issues. Also, the Catalog class previously allowed passing Node instances directly to the find method, which is now no longer possible because the Request class would treat the node as the instance being found. We need the request class to have two modes, one when it's passed an instance and one when it's passed a key.
* Adding a Request class to the Indirection layer. ThisLuke Kanies2008-04-081-82/+129
| | | | | | | | | class is currently only used internally by the Indirection instances, but I expect that I will soon be pushing it to all of the terminus types. I still need to fix a couple of tests that will get broken by this commit.
* Reworking the caching layer to use TTLs instead of versionsLuke Kanies2008-04-081-442/+485
| | | | | | based on timestamps. This just modifies the indirection class itself, there is still some work to do to remove version code from other classes.
* converting indirection specs away from setup/teardown to rspec compatible ↵Rick Bradley2008-02-181-232/+227
| | | | before/after usage
* Fixing #951 -- external nodes work again, but you have toLuke Kanies2007-12-101-0/+35
| | | | set the 'node_terminus' setting to 'exec'.
* Merge branch 'master' of git://reductivelabs.com/puppet into routingRick Bradley2007-10-261-8/+86
|\
| * File serving should work now, both recursive andLuke Kanies2007-10-241-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | single files, across modules, local file system, and the traditional file server. This work revolves around making sure that the termini produce functional file instances, meaning that they know how to find their content or metadata, which largely comes down to setting their paths correctly. I also created a new terminus base class for the local filesystem, since there was so much common code between content and metadata.
| * Adding post- hooks for :find and :search in the indirection class.Luke Kanies2007-10-231-0/+20
| |
| * Adding the calls to the authorization hooks in the Indirection.Luke Kanies2007-10-231-10/+62
| |
* | Merge branch 'master' of git://reductivelabs.com/puppet into routingRick Bradley2007-10-231-1/+8
|\|
| * Adding authorization hooks to the file_server andLuke Kanies2007-10-211-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | module_files indirection terminus types. Both hooks use the fileserver configuration, but the module_files hook only uses the 'modules' mount. Also moved all responsibility for knowing whether to use the 'modules' terminus type to the terminus selector; it was previously spread between that and the file_server terminus, which made some things annoyingly complicated. This normalizes the deprecation notices and the logic about how we make these decisions.
* | Merge branch 'master' of git://reductivelabs.com/puppet into routingRick Bradley2007-10-221-43/+144
|\| | | | | | | | | | | Conflicts: spec/unit/indirector/indirection.rb
| * I'm working on making file serving work in the indirector now, so ILuke Kanies2007-10-181-29/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added two abilities to the indirections: Models can specify a module to extend the indirection instance with, and indirections will use a :select_terminus method, if it's available, to select the terminus to use for finding. (It's currently only used for finding, not destroying or saving.) The upshot is that a model can have a module that handles terminus selection for it, and then extend its indirection with that module. This will allow me to use the local terminus when the protocol is 'file' and the REST terminus when the protocol is 'puppet'. It should also open the door for other protocols if they become available.
| * Adding spec stubs for authorization in the indirectionLuke Kanies2007-10-171-16/+50
| |
* | First pass through initializers of {mongrel, webrick} REST handlers; hooks ↵Rick Bradley2007-10-161-2/+12
|/ | | | into Indirection to look up models from indirected names.
* Reorganizing the file structure for indirection terminus types.Luke Kanies2007-10-151-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Previously, for example, the configuration terminus that was a subclass of 'code' would have been stored at lib/puppet/indirector/code/configuration and would have had to have been named 'configuration'. Now, the subclass can be named however the author prefers, and it must be stored at lib/puppet/indirector/configuration/<name>.rb, where <name> is the name you've chosen for the terminus type. The name only matters insomuch as it is used to load the file from disk and find the appropriate class when asked. The additional restriction is that the class constant for the terminus type must have its name as the last word, and the indirection must be the second to last word. Thus, in our example, we can choose any class constant that ends with Configuration::Code; given that there's only one Configuration class at this point, it makes the most sense to define the class as Puppet::Node::Configuration::Code. This is somewhat awkward, because of the class's location on disk, but the only other real option is to autogenerate a Puppet::Indirector::Configuration class constant, which is, I think, uglier.
* Adding version handling through most of the indirection work.Luke Kanies2007-10-121-0/+5
| | | | | | This counts as the first commit where configuration compiling actually uses the caching correctly according to the application model.
* All tests should now pass again.Luke Kanies2007-10-081-9/+9
| | | | | | | | | | | | | | This is the first real pass towards using caching. The `puppet` executable actually uses the indirection work, instead of handlers and such (and man! is it cleaner). Most of this work was a result of trying to get the client-side story working, with correct yaml caching of configurations, which means this commit also covers converting configurations to yaml, which was a much bigger PITA than it needed to be. I still need to write integration tests, and I also need to cover the server-side story of a normal configuration retrieval.
* Adding support for versions and freshness-checkingLuke Kanies2007-10-061-39/+123
| | | | | | to the indirection layers. This should hopefully enable the different application models we need in our different executables.
* Switching the indirection from using settings for configurationLuke Kanies2007-10-041-48/+54
| | | | | | | | | | | | | | | to requiring explicit configuration. This means that if you as an application developer want to use a different indirection terminus then you have to specify it; something like: Puppet::Node.terminus_class = :ldap Caches use the same kind of configuration: Puppet::Node.cache_class = :memory Accordingly, I've removed the existing setting definitions from the defaults.rb.
* Adding cache support to indirection. If you haveLuke Kanies2007-09-251-23/+122
| | | | | a '<indirection>_cache' setting, then the indirection will use the value there as the name of the cache.
* Renaming the 'Puppet::Util::Config' class toLuke Kanies2007-09-221-4/+4
| | | | | | | 'Puppet::Util::Settings'. This is to clear up confusion caused by the fact that we now have a 'Configuration' class to model host configurations, or any set of resources as a "configuration".
* Merge branch 'configurations' into indirectionLuke Kanies2007-09-221-5/+5
|\ | | | | | | | | | | | | | | | | Conflicts: lib/puppet/defaults.rb lib/puppet/indirector/facts/yaml.rb spec/unit/indirector/indirection.rb spec/unit/indirector/indirector.rb
| * An intermediate commit so I can start working on a differentLuke Kanies2007-09-201-1/+1
| | | | | | | | | | | | | | | | branch. The file recursion code actually works for the first time in a painful while, but there are still some quirks and design issues to resolve, particularly around creating implicit resources that then fail (i.e., the behaviour of the create_implicit_resource method in Configuration).
* | All indirections are working, and they have allLuke Kanies2007-09-221-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | been migrated over to the new organization. Where we would have previously had an 'ldap' node terminus at puppet/indirector/node/ldap.rb, we would not have it at puppet/indirector/ldap/node.rb, and it would be a subclass of puppet/indirector/ldap.rb. These are called terminus classes, and there are now three categories of them: The base class itself, abstract classes that provide most of the functionality (e.g., the ldap and yaml classes), and the classes themselves that implement the functionality for a given model like Node or Facts. The base terminus class handles auto-loading any of these classes from disk.
* | It looks like the new indirection setup is complete.Luke Kanies2007-09-211-5/+5
| | | | | | | | I only need to port the node indirection termini over.
* | Adding the first top-level terminus (yaml). It worksLuke Kanies2007-09-211-0/+15
| | | | | | | | | | | | | | | | | | | | | | and is tested, so now it is time to migrate the Facts YAML Terminus to use the <terminus>/<indirection> file structure instead of <indirection>/<terminus>. In this case, that means that I am moving the functionality in lib/puppet/indirector/facts/yaml.rb to lib/puppet/indirector/yaml/facts.rb, and the class in that new file will subclass Puppet::Indirector::Yaml.