| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
It is an adapatation of net-ssh-telnet, so that net-ssh conforms to
a saner interface for consumer.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
Calling this method caused storeconfigs not to run.
ActiveRecord::Base.allow_concurrency was deprecated in Rails 2.2. We
support activerecord 2.1 and higher, so we still need to call this
method for 2.1. I factored out the code that determines our
activerecord version to a method in util so that the code was easier to
read and test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2
3 Examples:
The code:
ctx = OpenSSL::SSL::SSLContext.new()
becomes:
ctx = OpenSSL::SSL::SSLContext.new
The code:
skip()
becomes:
skip
The code:
path = tempfile()
becomes:
path = tempfile
* Replaced 31 occurances of ^( *)end *#.* with \1end
3 Examples:
The code:
becomes:
The code:
end # Dir.foreach
becomes:
end
The code:
end # def
becomes:
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Replaced 6 occurances of (while .*?) *do$ with
The do is unneeded in the block header form and causes problems
with the block-to-one-line transformation.
3 Examples:
The code:
while line = f.gets do
becomes:
while line = f.gets
The code:
while line = shadow.gets do
becomes:
while line = shadow.gets
The code:
while wrapper = zeros.pop do
becomes:
while wrapper = zeros.pop
* Replaced 19 occurances of ((if|unless) .*?) *then$ with
The then is unneeded in the block header form and causes problems
with the block-to-one-line transformation.
3 Examples:
The code:
if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then
becomes:
if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
The code:
unless defined?(@spec_command) then
becomes:
unless defined?(@spec_command)
The code:
if c == ?\n then
becomes:
if c == ?\n
* Replaced 758 occurances of
((?:if|unless|while|until) .*)
(.*)
end
with
The one-line form is preferable provided:
* The condition is not used to assign a variable
* The body line is not already modified
* The resulting line is not too long
3 Examples:
The code:
if Puppet.features.libshadow?
has_feature :manages_passwords
end
becomes:
has_feature :manages_passwords if Puppet.features.libshadow?
The code:
unless (defined?(@current_pool) and @current_pool)
@current_pool = process_zpool_data(get_pool_data)
end
becomes:
@current_pool = process_zpool_data(get_pool_data) unless (defined?(@current_pool) and @current_pool)
The code:
if Puppet[:trace]
puts detail.backtrace
end
becomes:
puts detail.backtrace if Puppet[:trace]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Replaced 36 occurances of [$][?] with $CHILD_STATUS
3 Examples:
The code:
print "%s finished with exit code %s\n" % [host, $?.exitstatus]
becomes:
print "%s finished with exit code %s\n" % [host, $CHILD_STATUS.exitstatus]
The code:
$stderr.puts "Could not find host for PID %s with status %s" % [pid, $?.exitstatus]
becomes:
$stderr.puts "Could not find host for PID %s with status %s" % [pid, $CHILD_STATUS.exitstatus]
The code:
unless $? == 0
becomes:
unless $CHILD_STATUS == 0
* Replaced 3 occurances of [$][$] with $PID
3 Examples:
The code:
Process.kill(:HUP, $$) if restart_requested?
becomes:
Process.kill(:HUP, $PID) if restart_requested?
The code:
if pid == $$
becomes:
if pid == $PID
The code:
host[:name] = "!invalid.hostname.$$$"
becomes:
host[:name] = "!invalid.hostname.$PID$"
* Replaced 7 occurances of [$]& with $MATCH
3 Examples:
The code:
work.slice!(0, $&.length)
becomes:
work.slice!(0, $MATCH.length)
The code:
if $&
becomes:
if $MATCH
The code:
if $&
becomes:
if $MATCH
* Replaced 28 occurances of [$]:(?!:) with $LOAD_PATH
3 Examples:
The code:
sitelibdir = $:.find { |x| x =~ /site_ruby/ }
becomes:
sitelibdir = $LOAD_PATH.find { |x| x =~ /site_ruby/ }
The code:
$:.unshift "lib"
becomes:
$LOAD_PATH.unshift "lib"
The code:
$:.shift
becomes:
$LOAD_PATH.shift
* Replaced 3 occurances of [$]! with $ERROR_INFO
3 Examples:
The code:
$LOG.fatal("Problem reading #{filepath}: #{$!}")
becomes:
$LOG.fatal("Problem reading #{filepath}: #{$ERROR_INFO}")
The code:
$stderr.puts "Couldn't build man pages: " + $!
becomes:
$stderr.puts "Couldn't build man pages: " + $ERROR_INFO
The code:
$stderr.puts $!.message
becomes:
$stderr.puts $ERROR_INFO.message
* Replaced 3 occurances of ^(.*)[$]" with \1$LOADED_FEATURES
3 Examples:
The code:
unless $".index 'racc/parser.rb'
becomes:
unless $LOADED_FEATURES.index 'racc/parser.rb'
The code:
$".push 'racc/parser.rb'
becomes:
$LOADED_FEATURES.push 'racc/parser.rb'
The code:
$".should be_include("tmp/myfile.rb")
becomes:
$LOADED_FEATURES.should be_include("tmp/myfile.rb")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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?
|
|
|
|
| |
I'm also going to update the wiki to mention sqlite is a test dependency
|
|
|
|
| |
There was a comma missing from a raise, which caused a warning message on each run.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Disables the b64_zlib_yaml format if zlib cannot be loaded.
I've added a --no-zlib to make it possible to test this on a single
machine, but it might also be useful if someone finds themselves failing
to connect to a server that doesn't have zlib installed.
FactHandler' format is still hard-coded to YAML rather than using
facts.class.default_format
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bundeling and renaming the pure ruby json library to addresses a
number of cross version serliaization bugs (#2615, et al).
This patch adds a subset of the files from the json_pure gem to
lib/puppet/external/pson (renamed to avoid conflicts with rails) so
that we will always have a known-good erialization format available.
The pure ruby json gem as distibuted defers to the compiled version
if it is installed. This is problematic in some circumstances so the
files that have been brought over have been modified to always and
only use the bundled version.
It's a large patch, so here's a breakdown of the change categories:
The majority of the lines are only marginally interesting:
* The json lib itself (in lib/puppet/external/pson) make up the bulk
of the lines.
* Renaming of json to pson make up the second largest group.
Somewhat more interesting are the following, which can be located by
searching the diffs for the indicated strings:
* Adjusting tests to reflect the changes
* Changing the encoding/decoding behavior so that nested structures
(e.g. resources) don't serialize as escaped strings. This should
make it much easier to process the results with external tools, if
needed. Search for "to_pson" and "to_pson_data_hash"
* Cleaning up the envelope/metadata
* Now provides a document_type (as opposed to a ruby class name) by
using a symple registration scheme instead of constant lookup
(search for "document_type")
* Added an api_version (search for "api_version")
* Added a hash for document metadata (search for "metadata")
* Removing the yaml monkeypatch and instead disabling yaml serialization
on ruby 1.8.1 in favor of pson (search for "yaml")
* Cleaning up the json/rails feature interaction (they're now totally
independent) (search for "feature")
|
|
|
|
|
|
|
|
|
| |
ActiveRecord < 2.3.0 did not autoload active_record/version which
caused puppet to incorrectly believe ActiveRecord was not available.
This compliments 1a5c5b3 (Fixing #2508 - removing mention of
ActiveRecord 2.3).
Signed-off-by: Todd Zullinger <tmz@pobox.com>
|
| |
|
|
|
|
|
| |
We have to guarantee that the Rails code is loaded before the JSON code,
because Rails includes its own incompatible JSON support.
|
|
|
|
| |
Signed-off-by: Stéphan Gorget <gorget@ocre.cea.fr>
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
| |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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.
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2577 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
|
|
| |
header used to store the client SSL dn.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2558 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
|
|
| |
features
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2441 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2414 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2195 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2194 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2191 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2190 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
|
|
| |
in the Rails feature test, so that we don't kill everything if the machine has Rails installed, but it's an old version that doesn't support polymorphic associations
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2071 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1989 980ebf18-57e1-0310-9a29-db15c13687c0
|
|
|
|
| |
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1976 980ebf18-57e1-0310-9a29-db15c13687c0
|