summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
diff options
context:
space:
mode:
authorDominic Cleal <dcleal@redhat.com>2011-02-19 21:21:13 +0000
committerDominic Cleal <dcleal@redhat.com>2011-02-19 21:21:13 +0000
commitc87ec2598700c4e5236452a016f0497ec848cb90 (patch)
tree47a2435ef019bfcac2ec2aa388935173bc5c6b52 /lib/puppet/util
parent3eace859f20d9ac7366382826028af44c3ab62d6 (diff)
parentea348761df0b5297dbac50c7f1c48d22746524fa (diff)
downloadpuppet-c87ec2598700c4e5236452a016f0497ec848cb90.tar.gz
puppet-c87ec2598700c4e5236452a016f0497ec848cb90.tar.xz
puppet-c87ec2598700c4e5236452a016f0497ec848cb90.zip
Merge branch 'master' into tickets/master/4258-dev
Diffstat (limited to 'lib/puppet/util')
-rw-r--r--lib/puppet/util/checksums.rb25
-rwxr-xr-xlib/puppet/util/command_line/filebucket2
-rwxr-xr-xlib/puppet/util/command_line/pi2
-rwxr-xr-xlib/puppet/util/command_line/puppet2
-rwxr-xr-xlib/puppet/util/command_line/puppetca6
-rwxr-xr-xlib/puppet/util/command_line/puppetd16
-rwxr-xr-xlib/puppet/util/command_line/puppetdoc8
-rwxr-xr-xlib/puppet/util/command_line/puppetmasterd11
-rwxr-xr-xlib/puppet/util/command_line/puppetqd2
-rwxr-xr-xlib/puppet/util/command_line/puppetrun2
-rwxr-xr-xlib/puppet/util/command_line/ralsh2
-rw-r--r--lib/puppet/util/log.rb17
-rw-r--r--lib/puppet/util/log_paths.rb2
-rw-r--r--lib/puppet/util/logging.rb2
-rw-r--r--lib/puppet/util/metric.rb1
-rw-r--r--lib/puppet/util/reference.rb11
-rw-r--r--lib/puppet/util/settings.rb2
17 files changed, 70 insertions, 43 deletions
diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb
index 5aebd8392..e129301e6 100644
--- a/lib/puppet/util/checksums.rb
+++ b/lib/puppet/util/checksums.rb
@@ -1,6 +1,12 @@
# A stand-alone module for calculating checksums
# in a generic way.
module Puppet::Util::Checksums
+ class FakeChecksum
+ def <<(*args)
+ self
+ end
+ end
+
# Is the provided string a checksum?
def checksum?(string)
string =~ /^\{(\w{3,5})\}\S+/
@@ -55,11 +61,16 @@ module Puppet::Util::Checksums
end
# by definition this doesn't exist
+ # but we still need to execute the block given
def mtime_stream
+ noop_digest = FakeChecksum.new
+ yield noop_digest
nil
end
- alias :ctime_stream :mtime_stream
+ def mtime(content)
+ ""
+ end
# Calculate a checksum using Digest::SHA1.
def sha1(content)
@@ -99,12 +110,24 @@ module Puppet::Util::Checksums
File.stat(filename).send(:ctime)
end
+ alias :ctime_stream :mtime_stream
+
+ def ctime(content)
+ ""
+ end
+
# Return a "no checksum"
def none_file(filename)
""
end
def none_stream
+ noop_digest = FakeChecksum.new
+ yield noop_digest
+ ""
+ end
+
+ def none(content)
""
end
diff --git a/lib/puppet/util/command_line/filebucket b/lib/puppet/util/command_line/filebucket
index 8302d7b12..34b01508e 100755
--- a/lib/puppet/util/command_line/filebucket
+++ b/lib/puppet/util/command_line/filebucket
@@ -91,7 +91,7 @@
#
# = Copyright
#
-# Copyright (c) 2005 Reductive Labs, LLC
+# Copyright (c) 2005 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:filebucket].run
diff --git a/lib/puppet/util/command_line/pi b/lib/puppet/util/command_line/pi
index ae3c46e9a..3d80eea8f 100755
--- a/lib/puppet/util/command_line/pi
+++ b/lib/puppet/util/command_line/pi
@@ -42,7 +42,7 @@
#
# = Copyright
#
-# Copyright (c) 2005 Reductive Labs, LLC
+# Copyright (c) 2005 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:describe].run
diff --git a/lib/puppet/util/command_line/puppet b/lib/puppet/util/command_line/puppet
index 7b6c0ae7f..e75b92af8 100755
--- a/lib/puppet/util/command_line/puppet
+++ b/lib/puppet/util/command_line/puppet
@@ -63,7 +63,7 @@
#
# = Copyright
#
-# Copyright (c) 2005 Reductive Labs, LLC
+# Copyright (c) 2005 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:apply].run
diff --git a/lib/puppet/util/command_line/puppetca b/lib/puppet/util/command_line/puppetca
index 4f1a88da5..317d99881 100755
--- a/lib/puppet/util/command_line/puppetca
+++ b/lib/puppet/util/command_line/puppetca
@@ -27,7 +27,7 @@
# parameter, so you can specify '--ssldir <directory>' as an argument.
#
# See the configuration file documentation at
-# http://reductivelabs.com/projects/puppet/reference/configref.html for
+# http://docs.puppetlabs.com/references/stable/configuration.html for
# the full list of acceptable parameters. A commented list of all
# configuration options can also be generated by running puppet cert with
# '--genconfig'.
@@ -45,7 +45,7 @@
# Remove all files related to a host from puppet cert's storage. This is
# useful when rebuilding hosts, since new certificate signing requests
# will only be honored if puppet cert does not have a copy of a signed
-# certificate for that host. The certificate of the host remains valid.
+# certificate for that host. The certificate of the host is also revoked.
# If '--all' is specified then all host certificates, both signed and
# unsigned, will be removed.
#
@@ -104,7 +104,7 @@
#
# = Copyright
#
-# Copyright (c) 2005 Reductive Labs, LLC
+# Copyright (c) 2005 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:cert].run
diff --git a/lib/puppet/util/command_line/puppetd b/lib/puppet/util/command_line/puppetd
index 571b15486..71b28429b 100755
--- a/lib/puppet/util/command_line/puppetd
+++ b/lib/puppet/util/command_line/puppetd
@@ -11,7 +11,7 @@
#
# puppet agent [-D|--daemonize|--no-daemonize] [-d|--debug]
# [--detailed-exitcodes] [--disable] [--enable]
-# [-h|--help] [--fqdn <host name>] [-l|--logdest syslog|<file>|console]
+# [-h|--help] [--certname <host name>] [-l|--logdest syslog|<file>|console]
# [-o|--onetime] [--serve <handler>] [-t|--test] [--noop]
# [--digest <digest>] [--fingerprint] [-V|--version]
# [-v|--verbose] [-w|--waitforcert <seconds>]
@@ -113,10 +113,11 @@
#
# +puppet agent+ exits after executing this.
#
-# fqdn::
-# Set the fully-qualified domain name of the client. This is only used for
-# certificate purposes, but can be used to override the discovered hostname.
-# If you need to use this flag, it is generally an indication of a setup problem.
+# certname::
+# Set the certname (unique ID) of the client. The master reads this unique
+# identifying string, which is usually set to the node's fully-qualified domain
+# name, to determine which configurations the node will receive. Use this option
+# to debug setup problems or implement unusual node identification schemes.
#
# help::
# Print this help message
@@ -150,7 +151,8 @@
#
# test::
# Enable the most common options used for testing. These are +onetime+,
-# +verbose+, +ignorecache, +no-daemonize+, and +no-usecacheonfailure+.
+# +verbose+, +ignorecache, +no-daemonize+, +no-usecacheonfailure+,
+# +detailed-exit-codes+, +no-splay+, and +show_diff+.
#
# noop::
# Use +noop+ mode where the daemon runs in a no-op or dry-run mode. This is useful
@@ -180,7 +182,7 @@
#
# = Copyright
#
-# Copyright (c) 2005, 2006 Reductive Labs, LLC
+# Copyright (c) 2005, 2006 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:agent].run
diff --git a/lib/puppet/util/command_line/puppetdoc b/lib/puppet/util/command_line/puppetdoc
index 0fa1830d6..45a9c6518 100755
--- a/lib/puppet/util/command_line/puppetdoc
+++ b/lib/puppet/util/command_line/puppetdoc
@@ -3,7 +3,7 @@
#
# = Synopsis
#
-# Generate a reference for all Puppet types. Largely meant for internal Reductive
+# Generate a reference for all Puppet types. Largely meant for internal Puppet
# Labs use.
#
# = Usage
@@ -37,7 +37,7 @@
# Specifies the directory where to output the rdoc documentation in 'rdoc' mode.
#
# mode::
-# Determine the output mode. Valid modes are 'text', 'trac', 'pdf' and 'rdoc'. The 'pdf' mode creates PDF formatted files in the /tmp directory. The default mode is 'text'. In 'rdoc' mode you must provide 'manifests-path'
+# Determine the output mode. Valid modes are 'text', 'pdf' and 'rdoc'. The 'pdf' mode creates PDF formatted files in the /tmp directory. The default mode is 'text'. In 'rdoc' mode you must provide 'manifests-path'
#
# reference::
# Build a particular reference. Get a list of references by running +puppet doc --list+.
@@ -47,7 +47,7 @@
#
# = Example
#
-# $ puppet doc -r type > /tmp/type_reference.rst
+# $ puppet doc -r type > /tmp/type_reference.markdown
# or
# $ puppet doc --outputdir /tmp/rdoc --mode rdoc /path/to/manifests
# or
@@ -61,7 +61,7 @@
#
# = Copyright
#
-# Copyright (c) 2005-2007 Reductive Labs, LLC
+# Copyright (c) 2005-2007 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:doc].run
diff --git a/lib/puppet/util/command_line/puppetmasterd b/lib/puppet/util/command_line/puppetmasterd
index 74efb3818..445169820 100755
--- a/lib/puppet/util/command_line/puppetmasterd
+++ b/lib/puppet/util/command_line/puppetmasterd
@@ -9,6 +9,7 @@
#
# puppet master [-D|--daemonize|--no-daemonize] [-d|--debug] [-h|--help]
# [-l|--logdest <file>|console|syslog] [-v|--verbose] [-V|--version]
+# [--compile <nodename>] [--apply <catalog>]
#
# = Description
#
@@ -49,6 +50,14 @@
# version::
# Print the puppet version number and exit.
#
+# compile::
+# Capability to compile a catalogue and output it in JSON from the Puppet master. Uses
+# facts contained in the $vardir/yaml/ directory to compile the catalog.
+#
+# apply::
+# Capability to apply JSON catalog (such as one generated with --compile). You can either specify
+# a JSON file or pipe in JSON from standard input.
+#
# = Example
#
# puppet master
@@ -59,7 +68,7 @@
#
# = Copyright
#
-# Copyright (c) 2005 Reductive Labs, LLC
+# Copyright (c) 2005 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:master].run
diff --git a/lib/puppet/util/command_line/puppetqd b/lib/puppet/util/command_line/puppetqd
index 48fc952bd..81963d537 100755
--- a/lib/puppet/util/command_line/puppetqd
+++ b/lib/puppet/util/command_line/puppetqd
@@ -47,7 +47,7 @@
#
# = Copyright
#
-# Copyright (c) 2009 Reductive Labs, LLC
+# Copyright (c) 2009 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:queue].run
diff --git a/lib/puppet/util/command_line/puppetrun b/lib/puppet/util/command_line/puppetrun
index 27cd775b9..7eba3b2c4 100755
--- a/lib/puppet/util/command_line/puppetrun
+++ b/lib/puppet/util/command_line/puppetrun
@@ -120,7 +120,7 @@
#
# = Copyright
#
-# Copyright (c) 2005 Reductive Labs, LLC
+# Copyright (c) 2005 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:kick].run
diff --git a/lib/puppet/util/command_line/ralsh b/lib/puppet/util/command_line/ralsh
index 83338fcbc..5c1f719e2 100755
--- a/lib/puppet/util/command_line/ralsh
+++ b/lib/puppet/util/command_line/ralsh
@@ -83,7 +83,7 @@
#
# = Copyright
#
-# Copyright (c) 2005-2007 Reductive Labs, LLC
+# Copyright (c) 2005-2007 Puppet Labs, LLC
# Licensed under the GNU Public License
#Puppet::Application[:resource].run
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index a5aacc265..2f9f356bb 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -17,11 +17,12 @@ class Puppet::Util::Log
# Create a new destination type.
def self.newdesttype(name, options = {}, &block)
- dest = genclass(
- name, :parent => Puppet::Util::Log::Destination, :prefix => "Dest",
- :block => block,
- :hash => @desttypes,
-
+ dest = genclass(
+ name,
+ :parent => Puppet::Util::Log::Destination,
+ :prefix => "Dest",
+ :block => block,
+ :hash => @desttypes,
:attributes => options
)
dest.match(dest.name)
@@ -189,7 +190,7 @@ class Puppet::Util::Log
@levels.include?(level)
end
- attr_accessor :time, :remote, :file, :line, :version, :source
+ attr_accessor :time, :remote, :file, :line, :source
attr_reader :level, :message
def initialize(args)
@@ -203,7 +204,7 @@ class Puppet::Util::Log
tags.each { |t| self.tag(t) }
end
- [:file, :line, :version].each do |attr|
+ [:file, :line].each do |attr|
next unless value = args[attr]
send(attr.to_s + "=", value)
end
@@ -234,7 +235,7 @@ class Puppet::Util::Log
descriptors[:tags].each { |t| tag(t) }
- [:file, :line, :version].each do |param|
+ [:file, :line].each do |param|
next unless descriptors[param]
send(param.to_s + "=", descriptors[param])
end
diff --git a/lib/puppet/util/log_paths.rb b/lib/puppet/util/log_paths.rb
index f59197ed1..2fefd4505 100644
--- a/lib/puppet/util/log_paths.rb
+++ b/lib/puppet/util/log_paths.rb
@@ -15,7 +15,7 @@ module Puppet::Util::LogPaths
descriptors[:tags] = tags
- [:path, :file, :line, :version].each do |param|
+ [:path, :file, :line].each do |param|
next unless value = send(param)
descriptors[param] = value
end
diff --git a/lib/puppet/util/logging.rb b/lib/puppet/util/logging.rb
index f20444a3b..bc52b17f0 100644
--- a/lib/puppet/util/logging.rb
+++ b/lib/puppet/util/logging.rb
@@ -26,7 +26,7 @@ module Puppet::Util::Logging
end
def log_metadata
- [:file, :line, :version, :tags].inject({}) do |result, attr|
+ [:file, :line, :tags].inject({}) do |result, attr|
result[attr] = send(attr) if respond_to?(attr)
result
end
diff --git a/lib/puppet/util/metric.rb b/lib/puppet/util/metric.rb
index 7fdc6951f..835e1d610 100644
--- a/lib/puppet/util/metric.rb
+++ b/lib/puppet/util/metric.rb
@@ -132,6 +132,7 @@ class Puppet::Util::Metric
end
def newvalue(name,value,label = nil)
+ raise ArgumentError.new("metric name #{name.inspect} is not a string") unless name.is_a? String
label ||= self.class.labelize(name)
@values.push [name,label,value]
end
diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb
index 95efeb1c1..a4921ed2a 100644
--- a/lib/puppet/util/reference.rb
+++ b/lib/puppet/util/reference.rb
@@ -120,16 +120,11 @@ class Puppet::Util::Reference
str += "\n\n"
end
- # Remove all trac links.
- def strip_trac(text)
- text.gsub(/`\w+\s+([^`]+)`:trac:/) { |m| $1 }
- end
-
def text
puts output
end
- def to_rest(withcontents = true)
+ def to_markdown(withcontents = true)
# First the header
text = h(@title, 1)
text += "\n\n**This page is autogenerated; any changes will get overwritten** *(last generated on #{Time.now.to_s})*\n\n"
@@ -142,8 +137,4 @@ class Puppet::Util::Reference
text
end
-
- def to_text(withcontents = true)
- strip_trac(to_rest(withcontents))
- end
end
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index ca4ecda35..626ed20eb 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -593,7 +593,7 @@ if @config.include?(:run_mode)
end
eachsection do |section|
persection(section) do |obj|
- str += obj.to_config + "\n" unless ReadOnly.include? obj.name
+ str += obj.to_config + "\n" unless ReadOnly.include? obj.name or obj.name == :genconfig
end
end