summaryrefslogtreecommitdiffstats
path: root/spec/unit/util
Commit message (Collapse)AuthorAgeFilesLines
...
* feature #2276 Single Executable: move CommandLine methodsJesse Wolfe2010-02-171-56/+29
| | | | | | | move Util::CommandLine methods into instances instead of on the class, as suggested by Markus Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fix #3373 - Client side file streamingBrice Figureau2010-02-171-0/+20
| | | | | | | | | | This patch moves file content writing to the content properties and always write (or read) contents by chunks. This reduces drastically puppetd memory consumption when handling large sourced files. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* feature #2276 Single Executable: CommandLine can be instantiatedJesse Wolfe2010-02-171-0/+17
| | | | | | refactor CommandLine to be an object Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* feature #2276 Single Executable: subcommand methodJesse Wolfe2010-02-171-16/+34
| | | | | | Extract the logic to determine the subcommand name into a method. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* feature #2276 Single Executable: help for applyJesse Wolfe2010-02-171-0/+8
| | | | | | restore the help text for the apply command Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fix #3552 single executable should display usageJesse Wolfe2010-02-171-10/+10
| | | | | | | | | Added some tests to make the single executable command behavior explicit. Added logic to display the usage message if we're on a tty and no arguments are passed. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fix for #3690 failing to calculate error codesJesse Wolfe2010-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | This failure was getting caused by what I believe to be a bug in Puppet::Configurer where it always generated a new Puppet::Transaction::Report, even if one existed in an outer scope. In puppetd --test, a different Report was getting queried to generate the exit status than the one that was passed to the transaction -- this Report had no Metrics and would fail when queried. This obscured a second bug that Metrics could return nil for values if the Transaction had applied an empty Catalog, but Transaction::Report assumes that values will always be integers. It could be argued that an empty Report should be populated with empty Metrics before a Transaction is run, which would have prevented Report#exit_status from raising an exception ... which would have made these bugs much harder to track down. So, I've decided to leave that unchanged. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fix #3552 single executable should display usageJesse Wolfe2010-02-171-0/+70
| | | | | | | | | Added some tests to make the single executable command behavior explicit. Added logic to display the usage message if we're on a tty and no arguments are passed. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Remove test for old RDoc work-aroundJesse Wolfe2010-04-091-96/+0
|
* Adding "checksum?" helper method to Checksums moduleLuke Kanies2010-02-171-0/+16
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Finishing renaming :params to :parameters internallyLuke Kanies2010-02-171-1/+1
| | | | | | | | | | | | I had only done this partway, because it seemed easier, but not surprisingly, it ended up being more complex. In addition to those renames, this commit includes fixes to whatever tests I needed to fix to confirm that things were again working. I think most of these broken tests have been broken for a while. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Renaming Parser::ResourceType to Resource::TypeLuke Kanies2010-02-171-2/+2
| | | | | | | | | | Basically, these classes (ResourceType and ResourceTypeCollection) don't really belong in Parser, so I'm moving them to the Resource namespace. This will be where anything RAL-related goes from now on, and as we migrate functionality out of Puppet::Type, it should go here. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Renaming LoadedCode to ResourceTypeCollectionLuke Kanies2010-02-171-10/+10
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Storing per-environment LoadedCode instancesLuke Kanies2010-02-171-2/+2
| | | | | | | | | | | | This will soon replace all of the env/parser mungling we have to do. A given process will only be able to have one collection of code per environment in memory. This is somewhat limiting, in theory, but some global means of looking up code collection (LoadedCode instances) must exist for the pure ruby stuff to work. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Fix for #3366 - --tags '' treated as boolean 'true'Markus Roberts2010-02-171-2/+16
| | | | | This is the patch from Mike Pountney <Mike.Pountney@gmail.com> off the list with the additional test Luke requested.
* Fix for #3424 and tests to prove it.Markus Roberts2010-02-171-0/+38
| | | | | | | | The original pure ruby yaml patch missed some edge cases; specifically, classes that were modified by the syck version to directly call it and thus never reached the pure ruby version. This adds monkey patches to all of those case which we might reasonably care about (omitting, for example, calls within the syck version to itself) and tests which show that the monkey patch works.
* Cleaning up the Log initialization code.Luke Kanies2010-02-171-0/+7
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Refactoring the RAL interface to loggingLuke Kanies2010-02-171-2/+43
| | | | | | | | | | | Previously, the Log class knew a lot about RAL objects, but now the Logging module is the only one that does. This greatly simplifies the Log class, which is good, and means that whatever complexity does need to exist is directly exposed in the Logging middleware module. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding tests for "Logging" moduleLuke Kanies2010-02-171-0/+47
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Removing a redundant method in ReportLuke Kanies2010-02-171-1/+1
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding tests for the 'report' log destinationLuke Kanies2010-02-171-0/+24
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #2929 - Allow checksum to be "none"Brice Figureau2010-02-171-1/+7
| | | | | | | | | | | | | | | | File checksum is "md5" by default. When managing local files (not sourced or content) it might be desirable to not checksum files, especially when managing deep hierarchies containing many files. This patch allows to write such manifests: file { "/path/to/deep/hierarchy": owner => brice, recurse => true, checksum => none } Then puppet(d) won't checksum those files, just manage their ownership. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fixing #3148 Settings#without_noop when run with no noop settingLuke Kanies2010-02-171-0/+7
| | | | | | | Some tests didn't define this setting which caused this method to fail. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Merge branch '0.25.x'Markus Roberts2010-02-091-1/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: lib/puppet/agent.rb lib/puppet/application/puppet.rb lib/puppet/configurer.rb man/man5/puppet.conf.5 spec/integration/defaults.rb spec/unit/configurer.rb
| * Fix for #3094 (libdir should take ":" delimited path)Markus Roberts2010-01-301-1/+2
| | | | | | | | | | | | | | | | Actually, File::PATH_SEPARATOR, which is generally, but not always, ":"). Since libdir is also the default for the plugin handler, users will need to specify it explicitly if a multipart libdir is given (and it will need to be one of the segments given in the libdir for the plugins to be found).
* | Fix #2894 - exclude .pp files under modules files directoriesBrice Figureau2010-01-181-0/+6
| | | | | | | | | | | | | | | | | | | | Selinux modules files also ends in ".pp". Puppetdoc tries to parse them as if they are regular puppet files and then fails. This patch makes sure puppetdoc tells RDoc to exclude parsing .pp files in the modules files section. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Adapt to method name change since 8971d8Brice Figureau2010-01-181-2/+2
| | | | | | | | | | | | | | | | | | When the definition/hostclass/node AST types were removed, the parentclass method was renamed to 'parent'. This patch fixes the incorrect rdoc usage (and some deeper integration test so that it won't happen again). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Merge branch '0.25.x'James Turnbull2010-01-136-5/+65
|\| | | | | | | | | | | Conflicts: lib/puppet/ssl/host.rb spec/spec_helper.rb
| * Fix for #2995 (don't fail to load PSON when UTF-8 missing)Markus Roberts2009-12-311-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | We don't actually rely on iconv's UTF-8 support, so its absence shouldn't cause the PSON feature to fail on system (e.g. HPUX) where it isn't fully implemented. This change exposed a dependency on library load order that was causing Puppet::Util::Log to raise an error. I've removed the dependency of Puppet::Type from Puppet::Util::Log. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Fix for #2657 (retain old setting if config has syntax error)Markus Roberts2009-12-201-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This appears to be regression introduced by threading changes. The fix was to rearrange things to keep the old behaviour (don't clear the settings until you know the config file parses) and the new (don't nest calls to synchronize) by: 1. Splitting clear into two parts--clear, which works as before, and unsafe_clear which it calls and which expects synchronization to be handled externally. 2. Rearranging the code to recover the previous calling order 3. Trapping syntax errors and turning them into logged messages and a no-op effect. 4. Fixing reparse to not wrap a call to this code with a synchronize. 5. Tests. Signed-off-by: Markus Roberts <Markus@reality.com>
| * Fix #2966 spec/unit/util/queue.rb can't be run twiceJesse Wolfe2009-12-201-2/+10
| | | | | | | | | | | | | | | | This spec wasn't cleaing up after itself, and raised several exceptions when trying to register the same queue type again. Part of the #2879 test idempotency suite. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Fixing #2963 spec/unit/util/autoload.rb depends on global stateJesse Wolfe2009-12-201-0/+2
| | | | | | | | | | | | | | An Autoload spec was depending on files having not yet been autoloaded. Detected as part of #2879. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Fix for #2951 (SELinux test errors on OS X)Markus Roberts2009-12-181-2/+19
| | | | | | | | | | | | | | | | | | This makes the SELinux library marginally more robust by dealing consistently with a missing proc/mounts, and also resoves the test failures in a way that allows meaningful test runs on non-SELinux systems. Signed-off-by: Markus Roberts <Markus@reality.com>
| * Fixing 2907 rspec crash when spec/unit/application/puppetrun.rb is run after ↵Jesse Wolfe2009-12-111-1/+1
| | | | | | | | | | | | | | | | | | spec/unit/util/ldap/connection.rb the ldap/connection spec creates a mock LDAP class that causes `require 'ldap'` to explode. If `require 'ldap'` happens first, then we're OK. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Feature 2827 Option to disable managing internal filesJesse Wolfe2009-12-091-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | Add a flag "manage_internal_file_permissions" which is enabled by default. Disabling this flag prevents Puppet from managing the owner, group, or mode of files created from Puppet::Util::Settings::FileSetting I think this is a wide enough net to follow Luke's suggestion of "disable management of everything", and it certainly satisfies the requests I'm aware of, but if I've missed anything, let me know. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* | Merge branch '0.25.x'Luke Kanies2009-12-214-0/+191
|\| | | | | | | | | | | | | | | Conflicts: lib/puppet/agent.rb lib/puppet/application/puppetd.rb lib/puppet/parser/ast/leaf.rb lib/puppet/util/rdoc/parser.rb
| * Fixing #2791 fs_find should follow symlinksJesse Wolfe2009-11-251-0/+36
| | | | | | | | | | | | | | | | | | Symlinks confuse the "What file system am I on?" logic. This patch just runs the paths through a beefed up version of the standard 'realpath' method. Includes some of Markus's suggested changes. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Fixing 2792 selinux tries to set properties on unsupported filesystesJesse Wolfe2009-11-251-0/+6
| | | | | | | | | | | | | | | | | | Check that a specific file supports selinux properties before trying to set them. This patch is functionally identical to the one Darrell Fuhriman submitted with the bug report. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Fixing 904 RDoc::usage incompatible with rubygemsJesse Wolfe2009-11-191-0/+103
| | | | | | | | | | | | | | Monkey-patch workaround for RDoc so it doesn't get confused by rubygems stub executables. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Fixing 2806 Specifying multiple tags fails to apply any of themJesse Wolfe2009-11-131-0/+10
| | | | | | | | | | | | | | | | | | Fix code that was passing an Array of code to a method that was expecting a single tag. Includes Markus's suggestions Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
| * Bug #1742 Invalid params to --color outputs 'nil'Jesse Wolfe2009-10-261-0/+36
| | | | | | | | | | | | | | | | | | | | | | This patches fixes a bug where setting an invalid option for "--color" caused the word "nil" to be printed on every line of the log, instead of printing out log messages. Invalid color options now just produce uncolored output. It seems to me that this isn't important enough to issue a warning about an invalid setting. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* | Fixing #2596 - Node, Class, Definition are not ASTLuke Kanies2009-12-091-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit extracts these three classes into a single ResourceType class in the Parser heirarchy, now completely independent of the AST heirarchy. Most of the other changes are just changing the interface to the new class, which is greatly simplified over the previous classes. This opens up the possibility of drastically simplifying a lot of this other code, too -- in particular, replacing the reference to the parser with a reference to the (soon to be renamed) LoadedCode class. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Adding a context method to the Errors moduleLuke Kanies2009-12-092-1/+39
| | | | | | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* | Extracting language doc support into a moduleLuke Kanies2009-12-091-0/+32
| | | | | | | | | | | | | | This is so that you can still use docs without AST being the parent class. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Fix 2841 - Puppetdoc/RDoc parses realize functionBrice Figureau2009-12-021-0/+30
| | | | | | | | | | | | | | | | Puppetdoc wasn't parsing the realize function. This patch let puppetdoc find realize and display in RDoc html mode the list of realized resource per class or node. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Feature 2827 Option to disable managing internal filesJesse Wolfe2009-11-261-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | Add a flag "manage_internal_file_permissions" which is enabled by default. Disabling this flag prevents Puppet from managing the owner, group, or mode of files created from Puppet::Util::Settings::FileSetting I think this is a wide enough net to follow Luke's suggestion of "disable management of everything", and it certainly satisfies the requests I'm aware of, but if I've missed anything, let me know. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* | Fix #2649 Allow ssl dir creation in --noop modeRein Henrichs2009-11-191-0/+17
| | | | | | | | | | | | | | | | Wrap Puppet::Settings.use in a block that disables noop mode during the execution of the block and ensures that noop returns to its original value afterwards. This allows internal puppet catalog operations like ssl directory creation to occur even when puppet is run in --noop mode. This should actually solve a broader class of related bugs.
* | Fix #2796 - Fix puppetdoc rdoc selector parsingBrice Figureau2009-11-121-0/+12
| | | | | | | | | | | | | | | | | | This patch fix this bug by adding more to_s methods to ast member so that puppetdoc can just to_s the AST to reconstruct the original puppet code. Of course this is not perfect, but should work most of the time. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fix #2795 - puppetdoc rdoc reports a better error messageBrice Figureau2009-11-121-3/+21
| | | | | | | | | | | | | | | | | | | | When puppetdoc rdoc dies with an unhandled exception, the error message produced didn't mention the file and line where the parser choked. This patch fixes this by trying to locate on which AST structure the rdoc system failed. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fix #2784 - puppetdoc/rdoc didn't parse mono-instruction class contentBrice Figureau2009-11-041-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | class klass { include a, b, c } wasn't producing any rdoc documentation. We were thinking code was always embedded in an array which is not the case for mono-instruction code. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>