summaryrefslogtreecommitdiffstats
path: root/lib/puppet/feature/base.rb
Commit message (Collapse)AuthorAgeFilesLines
* (#8662) Break circular feature dependencyJosh Cooper2011-08-221-26/+28
| | | | | | | | | | | | | | | | | | | | The root feature was being evaluated prior to the microsoft_windows feature being defined. On Windows, this had the side-effect of calling Process.uid prior to the win32 sys/admin gem being loaded. And the default ruby implementation of Process.uid always returns 0, which caused Puppet.features.root? to always return true. This commit reorders the syslog, posix, microsoft_windows, and root features due to dependencies among them. This ensures the microsoft_windows feature is defined prior to evaluating the root feature. As a result of this commit, the SUIDManager now calls the win32 sys/admin version of the Process.uid method, which returns the RID component of the user's SID. As this is not 0, Puppet.features.root? will now always return false on Windows. A future commit will fix this, so that Puppet.feature.root? only returns true when running as the Windows-equivalent of root.
* (#8408/8409) Add a Windows ADSI helper moduleNick Lewis2011-08-191-0/+3
| | | | | | | | | | | | | | | | This module (Puppet::Util::ADSI) provides access to Active Directory Services Interfaces, using win32ole. The base module has methods for generating resource URIs and connecting to ADSI. It also provides classes Puppet::Util::ADSI::User and Puppet::Util::ADSI::Group for managing Active Directory users and groups, along with their properties and group memberships. This will be used to implement the Windows ADSI user and group providers. Based on work by: Joel Rosario <joel.r@.internal.directi.com> Based on work by: Cameron Thomas <cameron@puppetlabs.com> Reviewed-By: Matt Robinson <matt@puppetlabs.com> (cherry picked from commit b5fd95336e71ad428109cddf6cd2f33bdd31e025)
* Add basic service provider for WindowsCameron Thomas2011-08-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provider allows us to query the system state through "puppet resource", and manage the ensure, and enabled properties of services on Windows. This also adds support for a new enabled value of 'manual' on Windows only. With this we support the three major start types for services on Windows, with the following mapping of enabled to start type: true => Automatic false => Disabled manual => Manual (Demand) We use the win32-service gem to provide access to the Windows APIs for our operations. This does add a new gem requirement for running Puppet on Windows, but we were already requiring some gems from the same suite that win32-service is a part of. When referring to a service, the simple service name must be used, instead of the display name. For example, "snmptrap", instead of "SNMP Trap". All system services are reported in 'puppet resource service', including those started prior to run level 3 (system, device drivers, etc.). These services should probably not be managed, without careful thought and planning. This currently does not support being able to move a service from {enabled => false, ensure => stopped} to {enabled => true, ensure => running} (or enabled => manual) in a single Puppet run, since Puppet currently always tries to sync ensure before any other property. Because of this, the puppet run will fail every time, and the service must first be managed as {ensure => stopped, enabled => true} (or enabled => manual), before it can be managed as running and automatic start or manual start. Reviewed by: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 82476e8be41b62ce1767ab6854a72b481b917380)
* (#7581) Provide more detailed error message when missing gems on WindowsJacob Helwig2011-08-191-1/+9
| | | | | | | | | | | | | | | | | | Running Puppet on Windows requires the sys-admin, win32-process & win32-dir gems. If any of these gems were missing, Puppet would fail with the message "Cannot determine basic system flavour". When trying to determine if we are on Windows, we now warn with the message "Cannot run on Microsoft Windows without the sys-admin, win32-process & win32-dir gems: #{err}", where err is the normal ruby load error message stating which gem could not be loaded. We also only warn if the POSIX feature is not present. Signed-off-by: James Turnbull <james@puppetlabs.com> Signed-off-by: Jacob Helwig <jacob@puppetlabs.com> Reviewed-by: Cameron Thomas <cameron@puppetlabs.com> (cherry picked from commit faf8a5c05f50d98835a1db05b96146618f485a04)
* maint: remove inaccurate copyright and license statements.Daniel Pittman2011-08-181-3/+0
| | | | | | | | | | | For a while Luke, and other authors, injected a created tag, copyright statement, and "All rights reserved" into every new file they added to the Puppet project. This isn't really true, and we have a global license covering the code, so we have now stripped out all those old tags. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
* Fix #4726 Update puppet rrdtool metric code to support modern rrd ruby bindingsJesse Wolfe2010-09-281-1/+2
| | | | | | | | | The rrd project has been shipping ruby bindings since 1.3.0, and the old rrdtool ruby library is no longer being maintained. This patch is based upon Davor Ocelic's submitted code, with the addition that I've added conditionals so it can still call the old rrdtool library if a modern rrd is not installed.
* Code smell: Two space indentationMarkus Roberts2010-07-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
* Code smell: Win32 --> MS_windowsMarkus Roberts2010-07-091-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?
* maint: Confine a test that depends on sqliteMatt Robinson2010-06-281-0/+3
| | | | I'm also going to update the wiki to mention sqlite is a test dependency
* Fix for #3985 typo causing warningMarkus Roberts2010-06-261-1/+1
| | | | There was a comma missing from a raise, which caused a warning message on each run.
* [#4055] Add CouchDB terminus for factsRein Henrichs2010-02-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Implements an abstract CouchDB terminus and a concrete CouchDB terminus used to store node facts. Node facts are stored in a "node" document as the "facts" attribute. This node document may also be used by other couchdb termini that store node-related information. It is recommended to use a separate document (or documents) to store large data structures like catalogs, linking them to their related node document using embedded ids. This implementation depends on the "couchrest" gem. * Add Puppet.features.couchdb? * Add Puppet[:couchdb_url] setting * Add Puppet::Node::Facts#== for testing * Add PuppetSpec::FIXTURE_DIR for easy access to fixture files * Add CouchDB Terminus * Add Facts::CouchDB terminus * Stores facts inside a "node" document * Use key (hostname) as _id for node document * #find returns nil if document cannot be found * #save finds and updates existing document OR creates new doc [1] * Store facts in "facts" attribute of node document
* Move syslog into a featureDavid Schmitt2010-02-171-2/+5
|
* More win32? feature defDavid Schmitt2010-02-171-1/+1
|
* Define posix and win32 featuresDavid Schmitt2010-02-171-0/+11
|
* Feature #2935 Modes: root? predicateJesse Wolfe2010-02-171-1/+1
| | | | | | | 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>
* Closed #2937 - Migrated a number of requires to featuresJames Turnbull2009-12-181-0/+3
|
* Adding a "json" featureLuke Kanies2009-06-061-1/+0
| | | | | We have to guarantee that the Rails code is loaded before the JSON code, because Rails includes its own incompatible JSON support.
* Fix for #2234: test fails with old Rack versionChristian Hofstaedtler2009-05-201-2/+0
|
* Puppet as a Rack applicationChristian Hofstaedtler2009-05-021-0/+3
| | | | | | | This lays the ground: a wrapper for the REST handler, and an application confirming to the Rack standard. Also includes a base class for Rack handlers, as RackREST will not stay the only one, and there needs to be a central place where client authentication data can be checked.
* Moved RRD feature from util/metric.rb to feature/base.rbJames Turnbull2008-11-171-0/+3
|
* Added augeas type and featureJames Turnbull2008-10-241-0/+3
|
* Moving the webrick/mongrel "servers" over to HTTPServer module instead of ↵Rick Bradley2007-10-051-1/+1
| | | | Server. Using Server as the master class for client connections. Server (former RESTServer) will instantiate the appropriate subclass based upon Puppet configurator setting. There are now tests broken in the network section which I can't seem to figure out yet. Not a happy place to be.
* Adding support for providing a diff when files are being changed. Currently ↵Luke Kanies2007-08-271-1/+2
| | | | uses a local diff binary, but could easily be changed to use the ruby diff/lcs library. Modified puppet and puppetd to automatically show file diffs when in noop mode, but can otherwise be enabled using --show_diff. This only works when running interactively, because the diffs are printed on stdout.
* A few small fixes here and there, and the rest of the zones commitluke2007-06-141-1/+1
| | | | git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2577 980ebf18-57e1-0310-9a29-db15c13687c0
* Adding a simple unit test for mongrel, and adding the ability to select the ↵luke2007-06-111-0/+3
| | | | | | header used to store the client SSL dn. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2558 980ebf18-57e1-0310-9a29-db15c13687c0
* Switching the simpler features to a single file, so it is easier to add new ↵luke2007-04-301-0/+20
features git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2441 980ebf18-57e1-0310-9a29-db15c13687c0