summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
Commit message (Collapse)AuthorAgeFilesLines
* (#6723) Fix withenv environment restoration bugMax Martin2011-03-151-5/+4
| | | | | | Ensured that withenv properly restores the environment after it runs a block and added testing for the method. Reviewed-by: Matt Robinson and Daniel Pittman
* (#6513) Propagate the environment when doing variable lookup in settingsJacob Helwig2011-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | For example with the following: test.conf: [master] rrddir = /var/lib/puppet/rrd templatedir = /var/lib/puppet/templates [env_a] templatedir = $rrddir/templates rrddir = /tmp/env_a/ The command: RUBYLIB=lib bin/puppet master --config ./test.conf --environment env_a --configprint templatedir originally produced '/var/lib/puppet/rrd/templates' instead of the expected '/tmp/env_a/templates' Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
* Maint: Added the ability to replace the behavior ofPaul Berry2011-03-071-0/+26
| | | | | | | Puppet::Util.execute with an arbitrary code block for ease in spec testing. Reviewed-by: Max Martin <max@puppetlabs.com>
* (#5466) Monkey patch Symbol so that you can sort themMatt Robinson2011-02-281-0/+3
| | | | | | | | It turns out that the ability to sort symbols comes in the preinit section of application run when we load Facter and hit the code that adds the <=> method for symbols in lib/facter/util/plist/generator.rb Reviewed-by: Nick Lewis <nick@puppetlabs.com>
* Merge remote branch 'brice/tickets/2.6.x/6267' into 2.6.nextJesse Wolfe2011-02-252-0/+57
|\
| * Fix #6267 - puppetdoc embedded links to puppet entities are not hyperlinkedBrice Figureau2011-02-122-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Puppetdoc was relying on RDoc to provide the puppet entity (class, definition node, etc...) hyperlinking in comments. Unfortunately, RDoc was assuming namespaces are capitalized like Ruby namespaces and that definition would use the # or . separator. This change adds on top of RDoc puppet namespace format for classes and definition. This will make sure the comment hyperlinking will work as intented. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | (#6499) Make puppet respond identically to -h and --helpnfagerlund2011-02-251-1/+1
| | | | | | | | lib/puppet/util/command_line.rb had a special case for puppet --help to return generic help instead of the puppet apply help, but it would return puppet apply help when you gave it -h.
* | Maint: Add an assertion mechanism to PuppetPaul Berry2011-02-231-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows us to make C-style "assertions" in Puppet code, e.g.: assert_that { condition } assert_that(message) { condition } These methods will raise an exception if the environment variable PUPPET_ENABLE_ASSERTIONS is set to a non-empty value, and the the condition evaluates to false. If the environment variable PUPPET_ENABLE_ASSERTIONS is not set, then the condition is not even checked. Switching the assertions on with PUPPET_ENABLE_ASSERTIONS carries three advantages: 1. It makes it possible to put potentially expensive checks in assertions without degrading the performance of the code in production environments. 2. It allows strict assertions to catch Puppet bugs early in development, without increasing the risk of a crash in production environments. 3. It allows a simple command-line mechanism to run any Puppet command with assertions enabled.
* | Merge branch '2.6.x' into 2.6.nextJacob Helwig2011-02-142-6/+5
|\ \ | | | | | | | | | | | | | | | * 2.6.x: Updated CHANGELOG for 2.6.5rc4 (#3646) Fix the documentation fix for `puppet apply --apply`
| * | (#3646) Fix the documentation fix for `puppet apply --apply`Jacob Helwig2011-02-142-6/+5
| | | | | | | | | | | | | | | | | | | | | --apply is actually off of `puppet apply`, not off of `puppet agent` (nor `puppet master`), so move the documentation accordingly. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* | | Merge branch '2.6.x' into 2.6.nextJacob Helwig2011-02-142-8/+9
|\| | | | | | | | | | | | | | | | | * 2.6.x: Updated CHANGELOG for 2.6.5rc3 Updated fix for #3646 - apply / compile documentation
| * | Updated fix for #3646 - apply / compile documentationJames Turnbull2011-02-142-8/+9
| | |
* | | Merge branch 'masterzen/tickets/2.6/5720' into ↵Daniel Pittman2011-02-121-3/+5
|\ \ \ | |/ / |/| | | | | bug/2.6.next/5720-puppetdoc-fails-on-parameterized-class
| * | Fix #6281 - Make sure puppetdoc analyzes all filesBrice Figureau2011-02-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can happen that when parsing a file puppet parses other manifests if they get imported (this is at least true for site.pp, even in ignoreimport=true). Thus those files are now "watched". But puppetdoc needs to analyze all files, and since 99c101 we are now checking if the file was already parsed to not reparse it again. If that was the case, though, we weren't analyzing the produced code. Thus it was possible to not produce documentation for the site.pp content. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * | Fix #6280 - puppetdoc crashing on string interpolationBrice Figureau2011-02-111-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | The following manifest was crashing puppetdoc: class test { include "test::$operatingsystem" } Because the quoted string is "rendered" as a concat AST, which in turn ended being an array when entering RDoc. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Merge remote branch 'dan/ticket/2.6.4/5977' into 2.6.nextJesse Wolfe2011-02-081-2/+6
|\ \ | |/ |/|
| * (5977) Puppet::Applications can be loaded from multiple paths.Dan Bode2011-01-141-2/+6
| | | | | | | | | | | | | | - previously, Puppet would search $LOAD_PATH and just load applications in the first $LOAD_PATH to have the directory puppet/application. Now multiple paths can contain applications.
* | Merge branch 'bug/2.6.next/5755-gc-issue' into 2.6.nextPaul Berry2011-02-031-0/+2
|\ \ | | | | | | | | | | | | * bug/2.6.next/5755-gc-issue: Fix for #5755 -- making zaml serialization robust over projected objects
| * | Fix for #5755 -- making zaml serialization robust over projected objectsMarkus Roberts2011-02-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The core problem arose when the fix for #5048 in 31118fe85aca4 introduced a hook to replace objects dynamically durring serialization so that they could be projected / rewritten to a different form for backward compatability. The serialization code assumed that all objects being serialized would remain valid until the serialization was complete, but nothing retained a copy of the temporary objects created in the hook. To resolve this, the serialization layer now maintains a ref to each such object and clears them (to allow GC) after serialization is complete. Paired-with: Jesse Wolfe <jesse@puppetlabs.com> Paired-with: Paul Berry <paul@puppetlabs.com>
* | | (#4139) hook log autoflush into global defaultsDaniel Pittman2011-02-032-0/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We previously had an ordering dependency in the autoflush option, which was statically read from defaults when the log destination was configured. We add a hook in the defaults to update the log subsystem, which in turn updates log destinations, when autoflush is changed. This would work as desired: puppet agent --autoflush --logdest=file This would not work, as autoflush would be false: puppet agent --logdest=file --autoflush Now those changes propagate correctly. Paired-with: matt@puppetlabs.com
* | Merge branch '2.6.next' of git://github.com/puppetlabs/puppet into 2.6.nextMarkus Roberts2011-02-015-20/+12
|\ \
| * \ Merge remote branch 'james/tickets/2.6.x/5916' into 2.6.nextJesse Wolfe2011-02-012-12/+3
| |\ \
| | * | Fixes #5916 - Cleanup of unused doc methods and documentationJames Turnbull2011-01-172-12/+3
| | | |
| * | | Merge remote branch 'james/tickets/2.6.x/5914' into 2.6.nextJesse Wolfe2011-02-011-1/+1
| |\ \ \
| | * | | Fixed #5914 Removed genconfig = true from genconfig outputJames Turnbull2011-01-201-1/+1
| | |/ /
| * | | Merge remote branch 'jamtur01/tickets/2.6.x/5736' into 2.6.nextJacob Helwig2011-02-011-2/+2
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * jamtur01/tickets/2.6.x/5736: Modified rubydoc in lib/puppet/util/command_line/puppetca to fix inaccurate description of --clean.
| | * | | Modified rubydoc in lib/puppet/util/command_line/puppetca to fix inaccurate ↵nfagerlund2011-01-171-2/+2
| | |/ / | | | | | | | | | | | | description of --clean.
| * | | Merge remote branch 'james/tickets/2.6.x/5742' into 2.6.nextJesse Wolfe2011-02-011-5/+6
| |\ \ \
| | * | | Fixed #5742 - Removed legacy fqdn option from documentationJames Turnbull2011-01-171-5/+6
| | |/ / | | | | | | | | | | | | Patch from: Nick Fagerlund
* | / / Fix to fix for #5755 -- backref serialization issues in zamlMarkus Roberts2011-02-011-27/+25
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit addresses the original issue that the change reverted in the previous commit for #5755 was intended to fix by removing the special case on labels in emit (lables, even if they are never generated, are not "new lines" and thus @recent_nl should always be set to false when one is emitted). It also partially addresses a related issue wherein temporary strings generated when field names are constructed recycle their object_id (they are temporary) and thus cause incorrect back references. This commit "fixes" the problem by never generating backrefs to strings (treating them as immutable). It does not address other suspected issues such as thread safety durring serialization due to the use of class variables to store the seen-object hash or the use of object ids as "permanently unique" identifiers. Paired with: Daniel Pittman Advice & Commiseration: Jesse Wolfe
* | | Merge commit 'f279f2c24ad1c87940eca3592f4c6e2f5676c694' into 2.6.nextJacob Helwig2011-02-011-1/+2
|\ \ \ | | | | | | | | | | | | | | | | * commit 'f279f2c24ad1c87940eca3592f4c6e2f5676c694': Fixed #4968 - Updated list of options turned on by --test in documentation
| * | | Fixed #4968 - Updated list of options turned on by --test in documentationJames Turnbull2011-02-011-1/+2
| |/ / | | | | | | | | | | | | Reviewed-by: Jacob Helwig <jacob@puppetlabs.com> Reviewed-by: Jesse Wolfe <jesse@puppetlabs.com>
* | | Merge branch 'issues/2.6.next/5566' into 2.6.nextJacob Helwig2011-02-011-1/+13
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * issues/2.6.next/5566: (#5566) Treat source only File checksums as syntax errors when used with content Rename variable used in File type validation to be more clear Remove invalid "timestamp" and "time", and add missing "ctime" File checksum types. Remove order dependency when specifying source and checksum on File type
| * | | (#5566) Treat source only File checksums as syntax errors when used with contentJacob Helwig2011-02-011-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain checksum types (ctime, mtime) only make sense when used with the 'source' File parameter, since there is no way to check them on raw strings. Given the limitations of the current checksumming implementations, it is likely to introduce unexpected behavior when using the 'none' checksum type and either one of the 'source', and 'content' File parameters. Because of this, it is now a syntax error to use a checksum of 'none' with either parameter. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* | | | Merge remote branch 'jamtur01/tickets/2.6.x/3646' into 2.6.nextPaul Berry2011-02-011-0/+9
|\ \ \ \ | |/ / / |/| | | | | | | | | | | * jamtur01/tickets/2.6.x/3646: Fixed #3646 - Added documentation for compile and apply to man page
| * | | Fixed #3646 - Added documentation for compile and apply to man pageJames Turnbull2011-01-211-0/+9
| |/ /
* / / Bug #5755 -- ZAML generates extra newline in some hash backreferences.Daniel Pittman2011-01-311-4/+3
|/ / | | | | | | | | | | | | | | | | | | | | This data structure generates YAML with an extra newline that violates the syntax rules and all: list = [1] { :a => list, :b => list }.to_yaml This breaks real client use of the YAML catalogs, not to mention our own use of cached catalogs...
* | (#5715) Changed the type of metric names to always be strings.Paul Berry2010-12-301-0/+1
| |
* | (#5715) Removed Puppet::Util::Log#version.Paul Berry2010-12-303-5/+5
| | | | | | | | | | | | This attribute was only relevant in reports, and in reports it was redundant with Puppet::Transaction::Report#configuration_version and Puppet::Transaction::Report#puppet_version.
* | Merge branch 'ticket/2.6.4/5566' into 2.6.nextJesse Wolfe2010-12-161-0/+11
|\ \
| * | Fix #5566 none, mtime, and ctime checksum types can write file contentsJesse Wolfe2010-12-161-0/+11
| |/ | | | | | | | | | | | | The #write method in lib/puppet/type/file/content.rb relies on the block passed to #sum_stream getting executed. "none", "mtime", and "ctime" aren't real checksums, so they violated that assumption and just returned empty results. This patch causes that block to get executed.
* / (#5408) Attributes can be both audited and managedJesse Wolfe2010-12-101-5/+6
|/ | | | | | | | | | This patch makes it possible to both audit and manage an attribute. It introduces a new field on Event objects "historical_value", which is the value from state.yaml. The value from the RAL is written to state.yaml, and then the RAL is updated with the desired value. Paired-With: Nick Lewis <nick@puppetlabs.com> Paired-With: Matt Robinson <matt@puppetlabs.com>
* Renamed Reductive to PuppetJames Turnbull2010-11-2910-11/+11
| | | | I swear I've done this before. *confused*
* (#4726) Fix RRD legacy supportMatt Robinson2010-11-161-1/+1
| | | | | | | | There was a section of code that didn't take the legacy RRD library into account. This caused a unit test failure, but only if you have the RRD legacy library installed, which I did. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
* Fix for #4299 -- Don't require whichMarkus Roberts2010-11-122-9/+2
| | | | | | We already had an internal implementation of which hiding under an assumed name (Puppet::Util.binary); this commit calls it out of hiding and uses it consisantly.
* Fix for #4955 -- Race condition & memory leak in Puppet::UtilMarkus Roberts2010-11-121-2/+2
| | | | | | | | | | | | | | The Puppet::Util.sync method was not thread safe and also leaked memory. I'm not certain, but I believe the first is ironic and the second is merely a bug. This patch addresses the problem by 1) refactoring so the sync objects are never returned (and thus no one can cache a reference to one) 2) adding reference counting 3) deleting them when they are no longer needed 4) doing the thread safty dance. It wasn't the first (or even second) solution considered, but it's the one that I was able to make work in a way that I'm convinced is correct. Its main advantage is that it puts all the tricky bits in one place.
* Fix #4923 - close process race when truncating existing fileBrice Figureau2010-11-101-1/+4
| | | | | | | | | | | | | | | | | | | | | Using File.open(file, "w") calls open(2) with O_CREAT|O_TRUNC which means when the file exists it is immediately truncated. But the file is not locked yet, so another process can either write or read to the file, leading to file corruption. The fix is to truncate only when the file is exclusively locked. This can be done on some operating system with O_EXLOCK open(2) flag. I chose the more portable option of: * open * flock * truncate * write * close It might also be good to flush and fsync the file after writing it, otherwise in case of crash an incomplete file can stay on disk. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* capture stderr from exec resourcesNigel Kersten2010-11-101-1/+1
|
* Fix #3808 - puppetdoc should use --force-update only if RDoc supports itBrice Figureau2010-11-101-4/+5
| | | | | | This should allow to run puppetdoc on ruby 1.8.5. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #4911 - Do not generate doc for standard RDoc parser generated objectBrice Figureau2010-11-101-0/+6
| | | | | | | | | RDoc has some standard parsers for .c,.cc or fortran files (don't ask why). Unfortunately our html generator doesn't support the data structures generated by those parsers and we were bombing on unknown methods. This patch makes sure we generate html only for our own top level objects. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>