summaryrefslogtreecommitdiffstats
path: root/spec/unit
Commit message (Collapse)AuthorAgeFilesLines
...
| * Adding tests for Puppet::Indirector::Facts::Facter.loadfactsLuke Kanies2009-02-121-2/+9
| | | | | | | | | | | | | | I just copied the tests from the master branch, changed as necessary. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fixing #1541 - ParsedFile only backs up files once per transactionLuke Kanies2009-02-132-6/+36
| | | | | | | | | | | | | | | | This moves responsibility for backups from the filetype to the consumer of the filetype, but only ParsedFile actually uses filetypes. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Migrated FileType tests to spec, and fleshed them out a bit.Luke Kanies2009-02-131-0/+116
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
| * Bug #1948: Added patch by jab to support the correct ins syntax. Updated the ↵Bryan Kearney2009-02-131-12/+13
| | | | | | | | test cases as well
| * Fixing #961 - closing the http connection after every xmlrpc callLuke Kanies2009-02-121-0/+22
| | | | | | | | | | | | | | | | There were apparently some circumstances that resulted in the connection not being closed; this just closes it every time if it's still open after the rpc call is complete. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Refactoring the XMLRPC::Client error-handlingLuke Kanies2009-02-121-7/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I split it all into smaller, manageable chunks, and used methods for each step, instead of having one huge call. Note that I made all of the tests first, then refactored the code, so I'm confident there's no behavior change. I don't know that this is actually a lot cleaner, but it seems that way to me. I'm open to skipping this, but I think it makes the whole thing a lot cleaner. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fixing #1869 - autoloaded files should never leak exceptionsLuke Kanies2009-02-121-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Ruby's exception hierarchy is a bit strange, in that only exceptions that sub RuntimeError are caught by default. This patch explicitly catches the base class, Exception, which means that LoadError, SyntaxError, and any RuntimeErrors will all be caught. This is done for both load() and loadall(); load() uses Kernel.load, but loadall() uses Kernel.require. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Merge branch '0.24.x'Luke Kanies2009-02-1111-269/+333
|\| | | | | | | | | | | Conflicts: CHANGELOG spec/unit/type/file/selinux.rb
| * Moving the transaction specs to the right pathLuke Kanies2009-02-111-1/+1
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fixed #1884 - exported defines are collected by the exporting hostLuke Kanies2009-02-112-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was caused by the fix to #1472. That fix unexported any resources collected from the local catalog. The crux of this fix is that it separates 'exported' and 'virtual' a bit more. It also removes no-longer-needed functionality where resources copied their virtual or exported bits from the enclosing define or class. This is now obsolete because we don't evaluate virtual defined resources. The crux of this commit is that defined resources can stay exported even though they're evaluated, and that exported state won't inherit to contained resources such that those then don't get evaluated. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fix #1691 - Realize fails with array of Resource ReferencesBrice Figureau2009-02-111-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following snippet: realize( File["/tmp/a","/tmp/b"] ) is parsed into: AST::Function @name=realize @arguments= AST::ASTArray @children = [ AST::ResourceReference @title= AST::ASTArray @children = [ String(/tmp/a), String(/tmp/b) ] ] When evaluated: ResourceReference gives -> [ File[/tmp/a], File[/tmp/b] ] which means the function arguments are: [[File[/tmp/a], File[/tmp/b]] after evaluating the @arguments ASTArray of AST::Functions. Then the collector complains that it can't find the resource because it is not supposed to work on non-flattened resource array. The fix is to flatten in the realize function (although it can be done more generally in the AST::Function evaluation) before the resources are given to the Collector. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Fix #1682 - Resource titles are not flattened as they shouldBrice Figureau2009-02-111-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following manifest: $groups = ["foo", "bar"] $type_groups = ["baz", "quux"] $user_groups = [$groups, $type_groups] notify{ $user_groups: } which outputs: notice: foo notice: //Notify[foobar]/message: defined 'message' as 'foo' notice: baz notice: //Notify[bazquux]/message: defined 'message' as 'baz' is not equivalent to $user_groups = [ ["foo", "bar"], ["baz", "quux"] ] notify{ $user_groups: } which outputs: notice: foo notice: //Notify[foo]/message: defined 'message' as 'foo' notice: baz notice: //Notify[baz]/message: defined 'message' as 'baz' notice: bar notice: //Notify[bar]/message: defined 'message' as 'bar' notice: quux notice: //Notify[quux]/message: defined 'message' as 'quux' Obviously the second one manages to flatten the arrays and not the first one. This changeset adds flattening to the resource titles evaluations in order to be consitent in all cases. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Fix #1922 - Functions squash all arguments into a single hashBrice Figureau2009-02-111-2/+2
| | | | | | | | | | | | | | | | Revert "Fix #1682 - ASTArray should flatten product of evaluation of its children" This reverts commit c7ccc4ba7c42d56595564491ae578a1604c628d1. Bug #1824 and #1922 proved the fix for #1682 and #1691 was wrong. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Prefetching, and thus purging, Nagios resources now worksLuke Kanies2009-02-113-34/+90
| | | | | | | | | | | | | | | | | | | | | | *only* if you use the default configuration file locations. In the end, this was a relatively minor change; most of the actual diff centers around making the code more readable so I could think my way into the fix, and adding tests for cases that were either untested or refactored slightly. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Adding some basic tests for the Naginator provider base classLuke Kanies2009-02-111-0/+50
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fixing #1912 - gid still works with no 'should' value.Luke Kanies2009-02-111-0/+6
| | | | | | | | | | | | This makes 'ralsh' work again with users. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fixing #1920 - user passwords no longer allow ':'Luke Kanies2009-02-111-0/+4
| | | | | | | | | | | | | | | | | | I wanted to include a snide remark in the error, but... Now you just get an exception when creating the user if the password includes this character. Signed-off-by: Luke Kanies <luke@madstop.com>
| * Fixed #1852 - Correct behaviour when no SELinux bindingsJames Turnbull2009-01-271-0/+6
| |
* | Changing how the Configurer interacts with the cacheLuke Kanies2009-02-063-16/+39
| | | | | | | | | | | | | | | | | | 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 tests broken during the #1405 fix.Luke Kanies2009-02-062-0/+19
| | | | | | | | | | | | Most of these were small changes, like moved methods. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding an Agent::Runner class.Luke Kanies2009-02-062-0/+129
| | | | | | | | | | | | | | This will eventually be used by puppetrun, but for now is just called by the old-school Runner handler. Signed-off-by: Luke Kanies <luke@madstop.com>
* | The Agent now uses its lockfile to determine running stateLuke Kanies2009-02-061-6/+15
| | | | | | | | | | | | | | | | This makes it so we can easily create and use lots of agent instances, rather than having a single global instance with shared state. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Creating and using a new Puppet::Daemon classLuke Kanies2009-02-065-288/+388
| | | | | | | | | | | | | | | | | | | | | | | | This replaces the short-lived EventManager class, all of the service- and timer-related code in puppet.rb, and moves code from agent.rb, server.rb, and other places into one class responsible for starting, stopping, pids, and more. The Daemon module is no longer in existence, so it's been removed from the classes that were using it. 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>
* | Adding a 'close_all' method to the Log class.Luke Kanies2009-02-061-0/+8
| | | | | | | | | | | | This moves the code out of Daemon. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Removing restart-handling from ConfigurerLuke Kanies2009-02-061-22/+0
| | | | | | | | | | | | This will be handled by the Agent or the Daemon class. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding temporary class EventManagerLuke Kanies2009-02-061-0/+266
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the way through implementation of this class, I realized that most of its functionality will never actually be used. Thus, I'm refactoring it and the Puppet::Daemon module into a single Puppet::Daemon class with merged functionality, and then moving all of the daemon-like functionality out of both the Agent and Server classes. We'll then have a Daemon class that knows how to start and stop services, create and remove pidfiles, and whatever else daemons need to know how to do. This commit is to just so I have the current code snapshot. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Splitting the Agent class into Agent and ConfigurerLuke Kanies2009-02-066-256/+440
| | | | | | | | | | | | | | | | | | | | | | | | Once I went to add runinterval support to the Agent class, I realized it's really two classes: One that handles starting, stopping, running, et al (still called Agent), and one that handles downloading the catalog, running it, etc. (now called Configurer). This commit includes some additional code, but 95% of it is just moving code around. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Removing obsolete code and tests for the agent.Luke Kanies2009-02-061-163/+0
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Converting the catalog as neededLuke Kanies2009-02-062-26/+61
| | | | | | | | | | | | | | Converting to a Resource catalog for transmission, then converting to a RAL catalog on the client. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding REST support for facts and catalogs.Luke Kanies2009-02-062-0/+22
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding better error-handling to format renderingLuke Kanies2009-02-061-0/+45
| | | | | | | | | | | | | | We now always get the format name and the method that failed. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Resetting SSL cache terminii to nil when only using the caLuke Kanies2009-02-061-0/+8
| | | | | | | | | | | | | | | | This is important because puppetmasterd changes its configurations a couple of times, and we need to disable any previously-created caches. 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>
* | Moving the Agent locking code to a module.Luke Kanies2009-02-062-28/+94
| | | | | | | | | | | | | | Also cleaning up the lock usage by yielding to a block when a lock is attained. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Cleaning up SSL instances that can't be savedLuke Kanies2009-02-061-0/+23
| | | | | | | | | | | | | | | | | | | | | | If the SSL Host couldn't save a CSR or key, it would still keep them in memory; this meant that, for instance, a CSR that couldn't be saved to the server was never resent. This commit removes in-memory instances that couldn't be saved, thus forcing regeneration. 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>
* | Moving classfile-writing to the CatalogLuke Kanies2009-02-062-6/+32
| | | | | | | | | | | | | | | | This work was done by the Agent class before, but it's really related to the catalog, so that's where it is now. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Refactoring how the Facter integration worksLuke Kanies2009-02-063-42/+99
| | | | | | | | | | | | | | | | I moved all of the extra Fact modifications into the Facts class, and then moved the calls of those new methods into the Facter terminus. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Reformatting tests for factsLuke Kanies2009-02-061-30/+32
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Moving fact and plugin handling into modulesLuke Kanies2009-02-064-232/+421
| | | | | | | | | | | | | | | | | | | | This doesn't change functionality, it just simplifies the agent class. I've also started the work to get the catalog handling done using REST/the Indirector. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding Puppet client facts to Facter facts.Luke Kanies2009-02-061-0/+17
| | | | | | | | | | | | | | This work was previously done in the Master client class. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Clarifying how node names are used during catalog compilationLuke Kanies2009-02-061-50/+65
| | | | | | | | | | | | | | | | | | | | | | We now use any passed in node (used by bin/puppet), then any authenticated node info (e.g., the cert name), then any passed in information (usually the host name). The third option will never be used in Puppet's architecture, but simplifies using the API for other users. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Reformatting Indirector catalog compiler testsLuke Kanies2009-02-061-119/+121
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Renmaing Puppet::Network::Client::Master to Puppet::AgentLuke Kanies2009-02-061-23/+17
| | | | | | | | | | | | | | | | | | Made minor changes, including removing the parent class. The functionality hasn't changed yet -- that comes in later patches -- but all but a couple of the older tests pass. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Revert "Adding the first bits of an Agent class."Luke Kanies2009-02-061-117/+0
| | | | | | | | This reverts commit bbd99cc87a775732f2fed3686962647a5c30c5b8.
* | Revert "This is work that I've decided not to keep"Luke Kanies2009-02-063-238/+42
| | | | | | | | This reverts commit f57a5e88229578747dde2c90af3a696ad0172e72.
* | This is work that I've decided not to keepLuke Kanies2009-02-063-42/+238
| | | | | | | | | | | | | | so I'm just applying it here so it continues to show up in the history in case I ever want to look at it again. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding a new Agent::Downloader class for downloading files.Luke Kanies2009-02-061-0/+182
| | | | | | | | | | | | This will handling downloading facts and plugins. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding the first bits of an Agent class.Luke Kanies2009-02-061-0/+117
| | | | | | | | | | | | | | This class replaces the existing, all-knowing Client::Master class, and it will hopefully be more reasonable in scope. Signed-off-by: Luke Kanies <luke@madstop.com>