summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
Commit message (Collapse)AuthorAgeFilesLines
...
* Code smell: Win32 --> MS_windowsMarkus Roberts2010-07-092-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 12 occurances of Win32 with Microsoft Windows 3 Examples: The code: # and all .rb files in lib/. This is disabled by default on Win32. becomes: # and all .rb files in lib/. This is disabled by default on Microsoft Windows. The code: # We can use Win32 functions becomes: # We can use Microsoft Windows functions The code: desc "Uses Win32 functionality to manage file's users and rights." becomes: desc "Uses Microsoft Windows functionality to manage file's users and rights." * Replaced 10 occurances of :win32 with :microsoft_windows 3 Examples: The code: Puppet.features.add(:win32, :libs => ["sys/admin", "win32/process", "win32/dir"]) becomes: Puppet.features.add(:microsoft_windows, :libs => ["sys/admin", "win32/process", "win32/dir"]) The code: Puppet::Type.type(:file).provide :win32 do becomes: Puppet::Type.type(:file).provide :microsoft_windows do The code: confine :feature => :win32 becomes: confine :feature => :microsoft_windows * Replaced 13 occurances of win32\? with microsoft_windows? 3 Examples: The code: signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.win32? becomes: signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.microsoft_windows? The code: raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.win32? becomes: raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.microsoft_windows? The code: require 'sys/admin' if Puppet.features.win32? becomes: require 'sys/admin' if Puppet.features.microsoft_windows?
* Manifests with variables were broken when read from STDIN to puppet applyJesse Wolfe2010-07-091-0/+5
| | | | | Because the new settings scope was trying to interpolate the "code" string, causing strange failures.
* Use the name in the search path for looking for metadataBryan Kearney2010-07-091-0/+1
|
* [#4198] Require 'fileutils' everywhere FileUtils is usedJesse Wolfe2010-07-093-0/+3
|
* [#4196] Move the docs into the source directory structureJesse Wolfe2010-07-0910-0/+912
| | | | | | Since it is no longer possible to find the running executable from the call stack, docs have to be kept somewhere in the source tree. Of course, at this point, we shouldn't be using RDoc::Usage at all.
* Update RDoc parser to reflect change of custom plugin and fact locationsJames Turnbull2010-07-091-1/+1
|
* Fix for #4167 -- overriding file permissions in conf fileMarkus Roberts2010-07-072-1/+2
| | | | | The logic which iterates over the searchpath in reverse does not translate the name. Therefore file overrides in :master or :agent are not picked up.
* [#4114] Fix failures in the unit testsMatt Robinson2010-07-071-7/+2
| | | | | | The initial commit changed the name of a method (close -> close_all) and changed the way the array log destination worked before we saw that the unit tests were using it differently.
* [#4114] Added queueing to the logNick Lewis2010-07-072-29/+41
| | | | | The log will now queue any log messages created when there is no destination, and will flush the queue when a destination is added.
* Maint: Improve the speed of setting settings.Nick Lewis2010-07-021-12/+19
| | | | | Our settings were slow because I was querying Application objects for their run_mode repetitively
* maint: :mutable_defaults to improve spec consistencyJesse Wolfe2010-07-021-3/+3
| | | | | | Added a Puppet::Util::Settings layer called :mutable_defaults to emulate the interaction between Puppet::Application and defaults.rb that was getting thwarted by rspec.
* [#4090] Fix the run_mode for certs and put tests on the applications to ↵Matt Robinson2010-07-021-2/+2
| | | | | | | assert their run_mode Also cleanup of an unecessary puts line, make master tests run when on their own, and moving a require to a more usual spot.
* [#4090] Change how RunMode instances are created so that an object for each ↵Matt Robinson2010-07-011-0/+6
| | | | | | | RunMode is only created once instead of every time it's called Got lots of unpredictable test failures, presumably because a new RunMode was being created every time we accessed the RunMode.
* [#4090] Git rid of the idea that run_mode is a configurable option with defaultsMatt Robinson2010-07-011-2/+2
| | | | | Along the way this fixes an issue with 2.6 alpha that sections of the puppet config file were getting ignored.
* [#4090] Rename mode (:master, :agent, :user) to run_modeMatt Robinson2010-07-012-10/+10
| | | | | | | | Mode is a terribly overused word. Files use it, puppetdoc uses it, and certs use it, and those are just the places that I happened to stumble upon. It makes reading code very confusing and finding things in code difficult. I know namespacing allows us to reuse words for method and variable names, but that doesn't mean we should.
* [#4089] Replace internal usage of :check with :auditNick Lewis2010-07-011-1/+1
| | | | | | Per Luke's replacement of :check with :audit, and deprecation of :check, I've replaced all of our internal uses of :check with :audit. Importantly, this silence the deprecation warnings during regular usage from eg. ralsh.
* Fix #3932 - Add --charset to puppetdoc for RDoc modeBrice Figureau2010-02-171-1/+2
| | | | | | | This adds the --charset option to puppetdoc for RDoc mode. This allows to set the charset for the generated html. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* [#3865] External subcommandsJesse Wolfe2010-02-171-1/+14
| | | | | This patch allows the puppet single-executable to invoke external, hyphenated subcommands, much like how git does.
* [#3674] Make sure that failing to load a feature isn't fatalJesse Wolfe2010-02-171-1/+1
|
* [#3674] Part 2: Autoloader load method should propagate failuresJesse Wolfe2010-02-172-19/+2
| | | | | | | | | Change Autoloader's load to re-raise exceptions that happen when trying to load files, rather than just warning. This version still does not raise an error if the file is not found, as doing so would change the behavior of 'load' pretty significantly, but I am ambivalent this.
* [#3674] Autoloader should propagate failuresJesse Wolfe2010-02-171-1/+1
| | | | | | | Change Autoloader's loadall to re-raise exceptions that happen when trying to load files, rather than just warning. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fixes #3514 - CR/LF line ending in puppet.conf cause silent failureJames Turnbull2010-02-171-2/+2
| | | | Patch thanks to Alan Barrett
* Working #3139 - removing obsolete checking in StorageLuke Kanies2010-02-171-10/+2
| | | | | | | | | We were type-checking the use of Storage for no good reason. I've removed all of that, so we can use either resources or their Refs for caching. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Part 2 of fix for #1175 (functions in environments)Markus Roberts2010-02-171-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jesse and I are shooting for the minimal viable fix here, with the idea that a great deal of refactoring is needed but isn't appropriate at this time. The changes in this commit are: * Index the function-holding modules by environment * We need to know the "current environment" when we're defining a function so we can attach it to the proper module, and this information isn't dynamically available when user-defined functions are being created (we're being called by user written code that doesn't "know" about environments) so we cheat and stash the value in Puppet::Node::Environment * since we must do this anyway, it turns out to be cleaner & safer to do the same when we are evaluating a functon. This is the main change from the prior version of this patch. * Add a special *root* environment for the built in functions, and extend all scopes with it. * Index the function characteristics (name, type, docstring, etc.) by environment * Make the autoloader environment aware, so that it uses the modulepath for the specified environment rather than the default * Turn off caching of the modulepath since it potentially changes for each node * Tweak tests that weren't environment aware
* [#1621] Composite keys for resourcesJesse Wolfe2010-06-211-2/+1
| | | | | | | | | | | | | | | | This patch implements the fundamental pieces of the move to composite keys: * Instead of having a single namevar, we have a non-empty collection of them, and two resources are the same if and only if all of them match. Note that the present situation is a special case of this, where the collection always has exactly one member. * As currently, namevar is determined by the type. * Instead just of inferring the single namevar from the title we let types decompose the title into values for several (perhaps all) of the namevar components; note that the present situation is again a special case of this. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Resolving conflicts with jes5199:ticket/master/2935-settings-modeMarkus Roberts2010-02-171-2/+8
| | | | | | Jesse moved the code David was patching; the conflict resolution omits David's change (since the code isn't there to be changed) and this moves the change to the new location.
* Move syslog into a featureDavid Schmitt2010-02-171-1/+0
|
* Adapt Util::Storage specs and avoid trying to lock on directoriesDavid Schmitt2010-02-171-0/+4
|
* Avoid trying to set uid/gid on windowsDavid Schmitt2010-02-171-1/+2
|
* Make specs work on win32David Schmitt2010-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | lib/: * Fix Puppet::Parser::Files * Fix Puppet::Util::Settings spec/: * unit/application/kick.rb: only run on posix * unit/application.rb * unit/parser/compiler.rb * unit/parser/files.rb * unit/resource.rb * unit/resource/catalog.rb * unit/resource/type_collection.rb * unit/transaction.rb * unit/type/tidy.rb * unit/util/settings.rb * unit/util/settings/file_setting.rb * unit/application.rb
* Fix path handlingDavid Schmitt2010-02-172-4/+4
| | | | | *) Use File.expand_path as indicator for being an absolute path *) Use basename instead of parsing the path manually
* Avoid setting the timeout before we know which timeout we should set.David Schmitt2010-02-171-4/+4
| | | | Signed-off-by: David Schmitt <david@dasz.at>
* Avoid trying to lock on non-filesDavid Schmitt2010-02-171-0/+2
| | | | This is not supported on windows and makes little sense on POSIX
* Fix for #3949 and relatedMarkus Roberts2010-02-171-2/+3
| | | | | | | Syck/Yaml quietly passes on undefined classes as strings, so that if objects of those classes are loaded and re-serialized they passthrough unmodified. While not technically correct, it's still the POLS behavior, and we now support it.
* {#3866] Rename the method metaclass to singleton_class to avoid the ↵Matt Robinson2010-02-171-4/+4
| | | | | | | | | | | | 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
* For #3822 - Reducing checksum code duplicationLuke Kanies2010-02-171-0/+9
| | | | | | | | | | | The FileBucket code had a bunch of checksum code that was already available in a library, and it used a checksum format (type + data) that was incompatible with what we were using everywhere else. This just fixes that code duplication. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
* Feature #2935 remove misleading commentJesse Wolfe2010-02-171-4/+1
| | | | | | Remove a stale comment about how settings work Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2935 Unify the codepaths for setting settingsJesse Wolfe2010-02-171-6/+14
| | | | | | | | | There are two codepaths for setting settings in the settings object: one for setting individual settings, and one was setting settings in mass, like in the system settings file. This patch unifies some of that logic. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2935 Puppet[:mode] and Puppet[:name] are read-onlyJesse Wolfe2010-02-171-6/+18
| | | | | | | | | Historically, the Puppet[:name] setting has been settable, but the results of chaning it are poorly defined. The switch to modes instead of executable names seems like a good time to disable this complexity. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Bug: Broken codepath in util/settingsJesse Wolfe2010-02-171-1/+1
| | | | | | | | | An incorrect variable name is used in an error message, causing the error to throw an error. This can't appear in the wild, since it's actually just an argument check for the defaults.rb file. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2935 settings are in Mode sections instead of executable namesJesse Wolfe2010-02-171-28/+8
| | | | | | | A process's settings are now determined by Puppet::Mode rather than by the executable name. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2935: method extract require_applicationJesse Wolfe2010-02-171-1/+5
| | | | | | | It's useful to be able to require specific applications' ruby source by name, even if we aren't about to run them. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2935 Modes: root? predicateJesse Wolfe2010-02-172-2/+6
| | | | | | | Use a predicate method to check if we're running as root, rather than comparing the effective user id Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2935: lazify require graph for applicationsJesse Wolfe2010-02-171-2/+0
| | | | | | | | | Because environments have to declare their mode before puppet tries to load defaults.rb, it reduces the complexity considerably to have application classes to load their lib dependencies at the last possible moment. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Feature #2935: Puppet::ModeJesse Wolfe2010-02-171-0/+69
| | | | | | | | Create a Mode class and Puppet.mode and application.mode methods Mode can be "agent", "master", or "user". Each application sets a mode. The Mode object has some smarts about the defaults for that mode. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* feature #2276 Single Executable: move CommandLine methodsJesse Wolfe2010-02-171-44/+32
| | | | | | | move Util::CommandLine methods into instances instead of on the class, as suggested by Markus Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
* Fixed #3721 - Removed -u option from crontab on HP-UXJames Turnbull2010-02-171-1/+1
|
* Fix for conflict between fileserving streams and none-checksumsMarkus Roberts2010-02-171-0/+4
| | | | | | | | | | This was a classic semantic merge conflict; one patch adds a new type of checksum, with a routine to compute it on files; the other adds streams with routines to compute all the existing checksum types on them. They merge cleanly but theresult is incorrect. This patch completes the square by adding a none_stream routine to not-compute a checksum on a stream.
* Fix #3373 - Client side file streamingBrice Figureau2010-02-171-0/+25
| | | | | | | | | | 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: Pass a commandline object to the applicationJesse Wolfe2010-02-171-1/+1
| | | | | | Refactor so that the command line options only get parsed once Signed-off-by: Jesse Wolfe <jes5199@gmail.com>