summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
Commit message (Collapse)AuthorAgeFilesLines
...
* feature #2276 Single Executable: CommandLine can be instantiatedJesse Wolfe2010-02-171-1/+43
| | | | | | refactor CommandLine to be an object Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* feature #2276 Single Executable: subcommand methodJesse Wolfe2010-02-171-6/+39
| | | | | | 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/+1
| | | | | | 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-6/+4
| | | | | | | | | 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/+15
| | | | | | | | | 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 #3101 (bug in MRI 1.8.7)Markus Roberts2010-02-171-1/+12
| | | | | | | | | | | Due to a bug in Ruby 1.8.7 net/http will attempt to close a connection that wasn't successfully opened (it's nil), first checking to see if the connection is already close, and thus raising a method missing exception. This bug causes error messages that are confusing / misleading. To get around this, we add a closed? method to nil such that a nil (unopened) connection is always considered closed, allowing the real problem to be reported.
* Fixes #3419. OS X 10.6 Ruby doesn't set supplementary groupsNigel Kersten2010-02-171-2/+26
|
* Adding "checksum?" helper method to Checksums moduleLuke Kanies2010-02-171-0/+5
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Resolving conflicts with jesse:feature/master/3394Markus Roberts2010-02-171-1/+0
| | | | Without this change, rake spec crashes with a message about feature being undefined.
* Fixing most of the broken tests in test/Luke Kanies2010-02-171-1/+1
| | | | | | | | This involves a bit of refactoring in the rest of the code to make it all work, but most of the changes are fixing or removing old tests. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Removing Resource::Reference classesLuke Kanies2010-02-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is hopefully less messy than it first appears, but it's certainly cross-cutting. The reason for all of this is that we previously only looked up builtin resource types from outside the parser, but now that the defined resource types are available globally via environments, we can push that lookup code to Resource. Once we do that, however, we have to have environment and namespace information in every resource. Here I remove the Resource::Reference classes (except the AST class), and use Resource instances instead. I did this because the shared code between the two classes got incredibly complicated, such that they should have had a hierarchical relationship disallowed by their constants. This complexity convinced me just to get rid of References entirely. I also make Puppet::Parser::Resource a subclass of Puppet::Resource. There are still broken tests in test/, but this was a big enough commit I wanted to get it in. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Tuning file load orderLuke Kanies2010-02-171-0/+2
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Removing obsolete Settings comments and requireLuke Kanies2010-02-171-3/+0
| | | | Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Changing the interface of Puppet::ResourceLuke Kanies2010-02-171-2/+2
| | | | | | | | We need the ability to set the namespace and environment at initialization so the resource can look up qualified types. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Feature #3383 RAL over RESTJesse Wolfe2010-02-171-1/+0
| | | | | | | | ralsh --host works now, and is using REST. A node running puppetd --listen will allow ralsh to find, search, and modify live resources, via REST. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fixing callers to Parser to only pass environmentLuke Kanies2010-02-171-1/+1
| | | | | | | We previously passed a hash of options but now just the environment. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Always warning if autoloading a file failsLuke Kanies2010-02-171-12/+4
| | | | | | | This stops hiding some really difficult to track down problems. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Fix for #3366 - --tags '' treated as boolean 'true'Markus Roberts2010-02-171-2/+5
| | | | | 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-4/+6
| | | | | | | | 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.
* Fix for #2604 Pure Ruby yaml generationMarkus Roberts2010-02-172-0/+343
| | | | | | | | This patch brings in a pure ruby yaml generation library, analagous to what we did with JSON/PSON, but without the renaming dodge we had to do in that case to avoid fighting with Rails. Signed-off-by: Markus Roberts <Markus@reality.com>
* Cleaning up the Log initialization code.Luke Kanies2010-02-171-20/+24
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Refactoring the RAL interface to loggingLuke Kanies2010-02-173-10/+33
| | | | | | | | | | | 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>
* 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-172-0/+4
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* removing never-used codeLuke Kanies2010-02-171-61/+0
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Moving log destination code into separate filesLuke Kanies2010-02-173-276/+281
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Fix #2929 - Allow checksum to be "none"Brice Figureau2010-02-171-0/+5
| | | | | | | | | | | | | | | | 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-3/+2
| | | | | | | 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-093-2/+9
|\ | | | | | | | | | | | | | | | | | | 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-2/+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 for #3114 (ruby's arbitrary limit on process groups too low)Markus Roberts2010-01-301-0/+1
| | | | | | | | | | | | In some circumstances ruby's arbitrary limit on process groups is too low (32). This patch raises the limit in the recommended manner, to a value which should suffice in all practical cases (1024).
| * Partial reversion of patch for #3088 to fix #3104 (Exception misreported)Markus Roberts2010-01-242-3/+3
| | | | | | | | | | | | | | In my patch for #3088 I made a erroneous assumption about the ruby exception hierarchy and thus missed the fact that Timeout::error descends from both SignalError and Interrupt. This is a partial reversion of the patch for #3088 to let these through so that more useful error messages can be produced.
| * Fix for #3088 (catching Exception also traps SystemExit)Markus Roberts2010-01-242-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Changing rescues from the default to Exception (to catch errors that don't descend from StandardError) had the unintended consequence of catching (and suppressing) SystemExit. This patch restores the behavior of by reraising the exception. Of the other exceptions that fall through the same crack (NoMemoryError, SignalException, LoadError, Interrupt, NotImplementedError, and ScriptError) this patch also reraises NoMemoryError, SignalException, and Interrupt in the same way and leaves the rest captured.
* | Fix #2894 - exclude .pp files under modules files directoriesBrice Figureau2010-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | 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-3/+3
| | | | | | | | | | | | | | | | | | 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-138-58/+117
|\| | | | | | | | | | | Conflicts: lib/puppet/ssl/host.rb spec/spec_helper.rb
| * Fix for temporary file security wholeMarkus Roberts2010-01-051-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We create temporary files in /tmp/ with predictable names. These could be used by an attacker to DoS a box by setting a symlink to some other file (say, /etc/shadow) and waiting for us to overwrite it. The minimalistic solution employed by this patch is to wrap all such file writing with a paranoid wrapper that: 1) Check to see if the target exists 2) Issues a warning if it was a symlink 3) Deletes it 4) Waits (0.1 seconds if it was a file, 5 seconds if it was a symlink) 5) Opens the file with EXCL, which will fail if the file has come back. If this succeeds (as it normally will) it has exactly the same semantics as the original code (a must, as we are right at a release boundary). However, under no circumstances will it follow a preexisting symlink (the operating system guarantees this with EXCL) so the danger of an exploit has been converted into the possibility of a failure, with an appropriate warning.
| * Fix for #2995 (don't fail to load PSON when UTF-8 missing)Markus Roberts2009-12-312-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | 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-25/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 for #2965 (Chatty SELinux message)Markus Roberts2009-12-201-1/+1
| |
| * Fix for #2951 (SELinux test errors on OS X)Markus Roberts2009-12-181-2/+2
| | | | | | | | | | | | | | | | | | 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>
| * Closed #2937 - Migrated a number of requires to featuresJames Turnbull2009-12-181-5/+1
| |
| * Fix for #2911 (Allow capital letters in selinux contexts)Markus Roberts2009-12-121-1/+1
| | | | | | | | | | This is Matthias Saou's patch from the ticket; it adjusts the regular expression to permit capital letters where needed.
| * Fix for #2786 (failed trying to backup directory in recursive purge)Markus Roberts2009-12-111-1/+2
| | | | | | | | | | | | The refactoring in 8f60f0c50ee3dfb6453644f5dcded58e6e80e8bb lost the return code--should be true in all non-exception cases--and this was causing a false failure when the result was checked higher up.
| * Feature 2827 Option to disable managing internal filesJesse Wolfe2009-12-091-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Fixed #2798 - Correct issue with crontab provider on AIXAndrew Forgue2009-12-021-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | Clean up AIX crontab type: - The return "" if output.include?(...) prevented the raise from ever being reached. - Ensure the temp file is deleted after feeding it to cron. - Prevent dumping of the new crontab to STDOUT. Signed-off-by: Andrew Forgue <andrew.forgue@gmail.com>
| * Fix #2831 - puppetdoc doesn't cope with regex nodeBrice Figureau2009-11-271-3/+5
| | | | | | | | | | | | | | | | | | | | The problem is that regex node contains '/' which is a directory separator on unix. Since puppetdoc writes a file for each node this was creating empty directories and documentation for such node couldn't be stored. This patch removes the slashes in the node names. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Merge branch '0.25.x'Luke Kanies2009-12-218-21/+78
|\| | | | | | | | | | | | | | | 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-5/+16
| | | | | | | | | | | | | | | | | | 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>