Page MenuHomePhorge

No OneTemporary

diff --git a/CHANGELOG b/CHANGELOG
index 275e52f08..bf563dbce 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,890 +1,894 @@
+ Fixed a backward compatibility issue when running 0.23.x
+ clients against 0.24.0 servers -- relationships would
+ consistently not work. (#967)
+
Closing existing http connections when opening a new one,
and closing all connections after each run. (#961)
Removed warning about deprecated explicit plugins mounts.
0.24.0 (misspiggy)
Modifying the behaviour of the certdnsnames setting. It now defaults
to an empty string, and will only be used if it is set to something
else. If it is set, then the host's FQDN will also be added as
an alias. The default behaviour is now to add 'puppet' and
'puppet.$domain' as DNS aliases when the name for the cert being
signed is equal to the signing machine's name, which will only
be the case for CA servers. This should result in servers always
having the alias set up and no one else, but you can still override
the aliases if you want.
External node support now requires that you set the 'node_terminus'
setting to 'exec'. See the IndirectionReference on the wiki for more
information.
http_enable_post_connection_check added as a configuration
option for puppetd. This defaults to true, which validates the server
SSL certificate against the requested host name in new versions of ruby.
See #896 for more information.
Mounts no longer remount swap filesystems.
Slightly modifying how services manage their list of paths
(and adding documention for it). Services now default
to the paths specified by the provider classes.
Removed 'type' as a valid attribute for services, since it's been
deprecated since the creation of providers.
Removed 'running' as a valid attribute for services, since it's
been deprecated since February 2006.
Added modified patch by Matt Palmer which adds a 'plugins' mount,
fixing #891. See PluginsInModules on the wiki for information on
usage.
Empty dbserver and dbpassword settings will now be ignored when
initializing Rails connections (patch by womble).
Configuration settings can now be blank (patch by womble).
Added calls to endpwent/endgrent when searching for user and group IDs,
which fixes #791.
Obviated 'target' in interfaces, as all file paths were automatically
calculated anyway. The parameter is still there, but it's
not used and just generates a warning.
Fixing some of the problems with interface management on Red Hat.
Puppet now uses the :netmask property and does not try to set
the bootproto (#762).
You now must specify an environment and you are required to specify
the valid environments for your site. (#911)
Certificates now always specify a subjectAltName, but it defaults
to '*', meaning that it doesn't require DNS names to match. You
can override that behaviour by specifying a value for
'certdnsnames', which will then require that hostname as a match (#896).
Relationship metaparams (:notify, :require, :subscribe, and
:before) now stack when they are collecting metaparam values
from their containers (#446). For instance, if a resource
inside a definition has a value set for 'require', and you call
the definition with 'require', the resource gets both requires,
where before it would only retain its initial value.
Changed the behavior of --debug to include Mongrel client
debugging information. Mongrel output will be written to
the terminal only, not to the puppet debug log. This should
help anyone working with reverse HTTP SSL proxies. (#905)
Fixed #800 -- invalid configurations are no longer
cached. This was done partially by adding a relationship
validation step once the entire configuration is created,
but it also required the previously-mentioned changes
to how the configuration retrieval process works.
Removed some functionality from the Master client,
since the local functionality has been replaced
with the Indirector already, and rearranging how configuration
retrieval is done to fix ordering and caching bugs.
The node scope is now above all other scopes besides
the 'main' scope, which should help make its variables
visible to other classes, assuming those classes were
not included in the node's parent.
Replaced GRATR::Digraph with Puppet::SimpleGraph as
the base class for Puppet's graphing. Functionality
should be equivalent but with dramatically better
performance.
The --use-nodes and --no-nodes options are now obsolete.
Puppet automatically detects when nodes are defined, and if
they are defined it will require that a node be found,
else it will not look for a node nor will it fail if it
fails to find one.
Fixed #832. Added the '--no-daemonize' option to puppetd and
puppetmasterd. NOTE: The default behavior of 'verbose' and
'debug' no longer cause puppetd and puppetmasterd to not
daemonize.
Added k5login type. (#759)
Fixed CA race condition. (#693)
Added shortname support to config.rb and refactored addargs
0.23.2
Fixed the problem in cron jobs where environment settings
tended to multiple. (#749)
Collection of resources now correctly only collects exported
resources again. This was broken in 0.23.0. (#731)
'gen_config' now generates a configuration with
all parameters under a heading that matches the
process name, rather than keeping section headings.
Refactored how the parser and interpreter relate,
so parsing is now effectively an atomic process (thus
fixing #314 and #729). This makes the interpreter less
prone to error and less prone to show the error to the
clients. Note that this means that if a configuration
fails to parse, then the previous, parseable configuration
will be used instead, so the client will not know that
the configuration failed to parse.
Added support for managing interfaces, thanks to work
by Paul Rose.
Fixed #652, thanks to a patch by emerose; --fqdn again
works with puppetd.
Added an extra check to the Mongrel support so that
Apache can be used with optional cert checking, instead
of mandatory, thus allowing Mongrel to function as the CA.
This is thanks to work done by Marcin Owsiany.
0.23.1 (beaker)
You can now specify relationships to classes, which work
exactly like relationships to defined types:
require => Class[myclass]
This works with qualified classes, too.
You can now do simple queries in a collection of
exported resources. You still cannot do multi-condition queries,
though. (#703)
puppetca now exits with a non-zero code if it cannot
find any host certificates to clean. (Patch by Dean
Wilson.)
Fully-qualified resources can now have defaults. (#589)
Resource references can now be fully-qualified names,
meaning you can list definitions with a namespace as
dependencies. (#468)
Files modified using a FileType instance, as ParsedFile
does, will now automatically get backed up to the filebucket
named "puppet".
Added a 'maillist' type for managing mailing lists.
Added a 'mailalias' type for managing mail aliases.
Added patch by Valentin Vidic that adds the '+>' syntax to
resources, so parameter values can be added to.
The configuration client now pulls libraries down to $libdir,
and all autoloading is done from there with full support
for any reloadable file, such as types and providers. (#621)
Note that this is not backward compatible -- if you're using
pluginsync right now, you'll need to disable it on your clients
until you can upgrade them.
The Rails log level can now be set via (shockingly!) the
'rails_loglevel' parameter (#710). Note that this isn't
exactly the feature asked for, but I could not find a
way to directly copy ActiveRecord's concept of an environment.
External node sources can now return undefined classes (#687).
Puppet clients now have http proxy support (#701).
The parser now throws an error when a resource reference
is created for an unknown type. Also, resource references
look up defined types and translate their type accordingly. (#706)
Hostnames can now be double quoted.
Adding module autoloading (#596) -- you can now 'include' classes
from modules without ever needing to specifically load them.
Class names and node names now conflict (#620).
0.23.0
Modified the fileserver to cache file information, so that
each file isn't being read on every connection. Also,
added londo's patch from #678 to avoid reading entire files
into memory.
Fixed environment handling in the crontab provider (#669).
Added patch by trombik in #572, supporting old-style
freebsd init scripts with '.sh' endings.
Added fink package provider (#642), as provided by 'do'.
Marked the dpkg package provider as versionable (#647).
Applied patches by trombik to fix FreeBSD ports (#624 and #628).
Fixed the CA server so that it refuses to send back a certificate
whose public key doesn't match the CSR. Instead, it tells the
user to run 'puppetca --clean'.
Invalid certificates are no longer written to disk (#578).
Added a package provider (appdmg) able to install .app packages
on .dmg files on OS X (#641).
Applied the patch from #667 to hopefully kill the client hanging
problems (permanently, this time).
Fixed functions so that they accept most other rvalues as valid values
(#548).
COMPATIBILITY ALERT:
Significantly reworked external node support, in a way that's NOT
backward-compatible:
Only ONE node source can be used -- you can use LDAP, code, or
an external node program, but not more than one.
LDAP node support has two changes: First, the "ldapattrs" attribute is
now used for setting the attributes to retrieve from the server (in
addition to required attriutes), and second, all retrieved attributes
are set as variables in the top scope. This means you can set attributes
on your LDAP nodes and they will automatically appear as variables
in your configurations.
External node support has been completely rewritten. These programs must
now generate a YAML dump of a hash, with "classes" and "parameters" keys.
The classes should be an array, and the parameters should be a hash. The
external node program has no support for parent nodes -- the script must
handle that on its own.
Reworked the database schema used to store configurations with the
storeconfigs option.
Replaced the obsolete RRD ruby library with the maintained
RubyRRDtool library (which requires rrdtool2) (#659).
The Portage package provider now calls eix-update automatically
when eix's database is absent or out of sync (#666).
Mounts now correctly handle existing fstabs with no pass or dump values
(#550).
Mounts now default to 0 for pass and dump (#112).
Added urpmi support (#592).
Finishing up the type => provider interface work. Basically, package
providers now return lists of provider instances. In the proces,
I rewrote the interface between package types and providers, and also
enabled prefetching on all packages. This should significantly speed
up most package operations.
Hopefully fixing the file descriptor/open port problems, with patches
from Valentin Vidic.
Significantly reworked the type => provider interface with respect to
listing existing provider instances. The class method on both
class heirarchies has been renamed to 'instances', to start. Providers
are now expected to return provider instances, instead of creating
resources, and the resource's 'instances' method is expected to
find the matching resource, if any, and set the resource's
provider appropriately. This *significantly* reduces the reliance on
effectively global state (resource references in the resource classes).
This global state will go away soon.
Along with this change, the 'prefetch' class method on providers now
accepts the list of resources for prefetching. This again reduces
reliance on global state, and makes the execution path much easier
to follow.
Fixed #532 -- reparsing config files now longer throws an exception.
Added some warnings and logs to the service type so
users will be encouraged to specify either "ensure"
or "enabled" and added debugging to indicate why
restarting is skipped when it is.
Changed the location of the classes.txt to the state
directory.
Added better error reporting on unmatched brackets.
Moved puppetd and puppetmasterd to sbin in svn and fixed install.rb
to copy them into sbin on the local system appropriately. (#323)
Added a splay option (#501). It's disabled when running under
--test in puppetd. The value is random but cached. It defaults
to the runinterval but can be tuned with --splaylimit
Changing the notify type so that it always uses
the loglevel.
Fixing #568 - nodes can inherit from quoted node names.
Tags (and thus definitions and classes) can now be a single
character. (#566)
Added an 'undef' keyword (#629), which will evaluate to ""
within strings but when used as a resource parameter value
will cause that parameter to be evaluated as undefined.
Changed the topological sort algorithm (#507) so it will always
fail on cycles.
Added a 'dynamicfacts' configuration option; any facts in that
comma-separated list will be ignored when comparing facts to
see if they have changed and thus whether a recompile is necessary.
Renamed some poorly named internal variables:
@models in providers are now either @resource or
@resource_type (#605).
@children is no longer used except by components (#606).
@parent is now @resource within parameters (#607).
The old variables are still set for backward compatibility.
Significantly reworking configuration parsing. Executables all now
look for 'puppet.conf' (#206), although they will parse the old-style
configuration files if they are present, although they throw a deprecation
warning. Also, file parameters (owner, mode, group) are now set on the
same line as the parameter, in brackets. (#422)
Added transaction summaries (available with the --summarize option),
useful for getting a quick idea of what happened in a transaction.
Currently only useful on the client or with the puppet interpreter.
Changed the interal workings for retrieve and removed the :is attribute
from Property. The retrieve methods now return the current value of
the property for the system.
Removed acts_as_taggable from the rails models.
0.22.4
Execs now autorequire the user they run as, as long as the user
is specified by name. (#430)
Files on the local machine but not on the remote server during
a source copy are now purged if purge => true. (#594)
Providers can now specify that some commands are optional (#585).
Also, the 'command' method returns nil on missing commands,
rather than throwing an error, so the presence of commands
be tested.
The 'useradd' provider for Users can now manage passwords.
No other providers can, at this point.
Parameters can now declare a dependency on specific
features, and parameters that require missing features
will not be instantiated. This is most useful for
properties.
FileParsing classes can now use instance_eval to add
many methods at once to a record type.
Modules no longer return directories in the list of found
manifests (#588).
The crontab provider now defaults to root when there is no
USER set in the environment.
Puppetd once again correctly responds to HUP.
Added a syntax for referring to variables defined in
other classes (e.g., $puppet::server).
STDIN, STDOUT, STDERR are now redirected to /dev/null in
service providers descending from base.
Certificates are now valid starting one day before they are
created, to help handle small amounts of clock skew.
Files are no longer considered out of sync if some properties
are out of sync but they have no properties that can create
the file.
0.22.3
Fixed backward compatibility for logs and metrics from older clients.
Fixed the location of the authconfig parameters so there aren't
loading order issues.
Enabling attribute validation on the providers that subclass
'nameservice', so we can verify that an integer is passed to
UID and GID.
Added a stand-alone filebucket client, named 'filebucket'.
Fixed the new nested paths for filebuckets; the entire md5 sum was
not being stored.
Fixing #553; -M is no longer added when home directories are being
managed on Red Hat.
0.22.2 (grover)
Users can now manage their home directories, using the managehome
parameter, partially using patches provided by Tim Stoop and
Matt Palmer. (#432)
Added 'ralsh' (formerly x2puppet) to the svn tree. When possible it
should be added to the packages.
The 'notify' type now defaults to its message being the same as its name.
Reopening $stdin to read from /dev/null during execution, in hopes that
init scripts will stop hanging.
Changed the 'servername' fact set on the server to use the server's fqdn,
instead of the short-name.
Changing the location of the configuration cache. It now defaults to being
in the state directory, rather than in the configuration directory.
All parameter instances are stored in a single @parameters instance variable
hash within resource type instances. We used to use separate hashes for
each parameter type.
Added the concept of provider features. Eventually these should be able
to express the full range of provider functionality, but for now they can
test a provider to see what methods it has set and determine what features it
provides as a result. These features are integrated into the doc generation
system so that you get feature documentation automatically.
Switched apt/aptitide to using "apt-cache policy" instead of "apt-cache showpkg"
for determining the latest available version. (#487)
FileBuckets now use a deeply nested structure for storing files, so
you do not end up with hundreds or thousands of files in the same
directory. (#447)
Facts are now cached in the state file, and when they change the configuration
is always recompiled. (#519)
Added 'ignoreimport' setting for use in commit hooks. This causes the
parser to ignore import statements so a single file can be parse-checked. (#544)
Import statements can now specify multiple comma-separated arguments.
Definitions now support both 'name' and 'title', just like any other
resource type. (#539)
Added a generate() command, which sets values to the result of an external
command. (#541)
Added a file() command to read in files with no interpolation. The first
found file has its content returned.
puppetd now exits if no cert is present in onetime mode. (#533)
The client configuration cache can be safely removed and the client
will correctly realize the client is not in sync.
Resources can now be freely deleted, thus fixing many problems introduced
when deletion of required resources was forbidden when purging was introduced.
Only resources being purged will not be deleted.
Facts and plugins now download even in noop mode (#540).
Resources in noop mode now log when they would have responded to an event (#542).
Refactored cron support entirely. Cron now uses providers, and there
is a single 'crontab' provider that handles user crontabs. While this
refactor does not include providers for /etc/crontab or cron.d, it should
now be straightforward to write those providers.
Changed the parameter sorting so that the provider parameter comes
right after name, so the provider is available when the other parameters
and properties are being created.
Redid some of the internals of the ParsedFile provider base class.
It now passes a FileRecord around instead of a hash.
Fixing a bug related to link recursion that caused link directories
to always be considered out of sync.
The bind address for puppetmasterd can now be specified with
--bindaddress.
Added (probably experimental) mongrel support. At this point you're
still responsible for starting each individual process, and you have to
set up a proxy in front of it.
Redesigned the 'network' tree to support multiple web servers, including
refactoring most of the structural code so it's much clearer and more
reusable now.
Set up the CA client to default to ca_server and ca_port, so you can
easily run a separate CA.
Supporting hosts with no domain name, thanks to a patch from
Dennis Jacobfeuerborn.
Added an 'ignorecache' option to tell puppetd to force a recompile, thanks to
a patch by Chris McEniry.
Made up2date the default for RHEL < 4 and yum the default for the rest.
The yum provider now supports versions.
Case statements correctly match when multiple values are provided,
thanks to a patch by David Schmitt.
Functions can now be called with no arguments.
String escapes parse correctly in all cases now, thanks to a patch by
cstorey.
Subclasses again search parent classes for defaults.
You can now purge apt and dpkg packages.
When doing file recursion, 'ensure' only affects the top-level directory.
States have been renamed to Properties.
0.22.1 (kermit) -- Mostly a bugfix release
Compile times now persist between restarts of puppetd.
Timeouts have been added to many parts of Puppet, reducing the likelihood
if it hanging forever on broken scripts or servers.
All of the documentation and recipes have been moved to the wiki by Peter
Abrahamsen and Ben Kite has moved the FAQ to the wiki.
Explicit relationships now override automatic relationships, allowing you
to manually specify deletion order when removing resources.
Resources with dependencies can now be deleted as long as all of their
dependencies are also being deleted.
Namespaces for both classes and definitions now work much more consistently.
You should now be able to specify a class or definition with a namespace
everywhere you would normally expect to be able to specify one without.
Downcasing of facts can be selectively disabled.
Cyclic dependency graphs are now checked for and forbidden.
The netinfo mounts provider was commented out, because it really doesn't
work at all. Stupid NetInfo stores mount information with the device as
the key, which doesn't work with my current NetInfo code.
Otherwise, lots and lots of bugfixes. Check the tickets associated with the
'kermit' milestone.
0.22.0
Integrated the GRATR graph library into Puppet, for handling resource
relationships.
Lots of bug-fixes (see bugs tickets associated with the 'minor' milestone).
Added new 'resources' metatype, which currently only includes the ability
to purge unmanaged resources.
Added better ability to generate new resource objects during transactions
(using 'generate' and 'eval_generate' methods).
Rewrote all Rails support with a much better database design. Export/collect
now works, although the database is incompatible with previous versions.
Removed downcasing of facts and made most of the language case-insensitive.
Added support for printing the graphs built during transactions.
Reworked how paths are built for logging.
Switched all providers to directly executing commands instead of going through
a subshell, which removes the need to quote or escape arguments.
0.20.1
Mostly a bug-fix release, with the most important fix being the
multiple-definition error.
Completely rewrote the ParsedFile system; each provider is now much
shorter and much more maintainable. However, fundamental problems
were found with the 'port' type, so it was disabled. Also, added
a NetInfo provider for 'host' and an experimental NetInfo provider
for 'mount'.
Made the RRDGraph report *much* better and added reference
generation for reports and functions.
0.20.0
Significantly refactored the parser. Resource overrides now consistently
work anywhere in a class hierarchy.
The language was also modified somewhat. The previous export/collect syntax
is now used for handling virtual objects, and export/collect (which is still
experimental) now uses double sigils (@@ and <<| |>>).
Resource references (e.g., File["/etc/passwd"]) now have to be capitalized,
in fitting in with capitalizing type operations.
As usual, lots of other smaller fixes, but most of the work was in the language.
0.19.3
Fixing a bug in server/master.rb that causes the hostname
not to be available in locally-executed manifests.
0.19.2
Fixing a few smaller bugs, notably in the reports system.
Refreshed objects now generate an event, which can result in further
refreshes of other objects.
0.19.1
Fixing two critical bugs: User management works again and cron jobs are
no longer added to all user accounts.
0.19.0
Added provider support.
Added support for %h, %H, and %d expansion in fileserver.conf.
Added Certificate Revocation support.
Made dynamic loading pervasive -- nearly every aspect of Puppet will now
automatically load new instances (e.g., types, providers, and reports).
Added support for automatic distribution of facts and plugins (custom types).
0.18.4
Another bug-fix release. The most import bug fixed is that
cronjobs again work even with initially empty crontabs.
0.18.3
Mostly a bug-fix release; fixed small bugs in the functionality added in
0.18.2.
0.18.2
Added templating support.
Added reporting.
Added gem and blastwave packaging support.
0.18.1
Added signal handlers for HUP, so both client and server deal correctly with it.
Added signal handler for USR1, which triggers a run on the client.
As usual, fixed many bugs.
Significant fixes to puppetrun -- it should behave much more correctly now.
Added "fail" function which throws a syntax error if it's encountered.
Added plugin downloading from the central server to the client. It must be
enabled with --pluginsync.
Added support for FreeBSD's special "@daily" cron schedules.
Correctly handling spaces in file sources.
Moved documentation into svn tree.
0.18.0
Added support for a "default" node.
When multiple nodes are specified, they must now be comma-separated (this
introduces a language incompatibility).
Failed dependencies cause dependent objects within the same transaction
not to run.
Many updates to puppetrun
Many bug fixes
Function names are no longer reserved words.
Links can now replace files.
0.17.2
Added "puppetrun" application and associated runner server and client classes.
Fixed cron support so it better supports valid values and environment settings.
0.17.1
Fixing a bug requiring rails on all Debian boxes
Fixing a couple of other small bugs
0.17.0
Adding ActiveRecord integration on the server
Adding export/collect functionality
Fixing many bugs
0.16.5
Fixing a critical bug in importing classes from other files
Fixing nodename handling to actually allow dashes
0.16.4
Fixing a critical bug in puppetd when acquiring a certificate for the first
time
0.16.3
Some significant bug fixes
Modified puppetd so that it can now function as an agent independent
of a puppetmasterd process, e.g., using the PuppetShow web application.
0.16.2
Modified some of the AST classes so that class names, definition names, and
node names are all set within the code being evaluated, so 'tagged(name)' returns
true while evaluating 'name', for instance.
Added '--clean' argument to puppetca to remove all traces of a given
client.
0.16.1
Added 'tagged' and 'defined' functions.
Moved all functions to a general framework that makes it very easy to add new
functions.
0.16.0
Added 'tag' keyword/function.
Added FreeBSD Ports support
Added 'pelement' server for sending or receiving Puppet objects, although
none of the executables use it yet.
0.15.3
Fixed many bugs in :exec, including adding support for arrays of checks
Added autoloading for types and service variants (e.g., you can now
just create a new type in the appropriate location and use it in Puppet,
without modifying the core Puppet libs).
0.15.2
Added darwinport, Apple .pkg, and freebsd package types
Added 'mount type
Host facts are now set at the top scope (Bug #103)
Added -e (inline exection) flag to 'puppet' executable
Many small bug fixes
0.15.1
Fixed 'yum' installs so that they successfully upgrade packages.
Fixed puppetmasterd.conf file so group settings take.
0.15.0
Upped the minor release because the File server is incompatible with 0.14,
because it now handles links.
The 'symlink' type is deprecated (but still present), in favor of using
files with the 'target' parameter.
Unset variables no longer throw an error, they just return an empty string
You can now specify tags to restrict which objects run during a given run.
You can also specify to skip running against the cached copy when there's
a failure, which is useful for testing new configurations.
RPMs and Sun packages can now install, as long as they specify a package
location, and they'll automatically upgrade if you point them to a new
file with an upgrade.
Multiple bug fixes.
0.14.1
Fixed a couple of small logging bugs
Fixed a bug with handling group ownership of links
0.14.0
Added some ability to selectively manage symlinks when doing file management
Many bug fixes
Variables can now be used as the test values in case statements and selectors
Bumping a minor release number because 0.13.4 introduced a protocol
incompatibility and should have had a minor rev bump
0.13.6
Many, many small bug fixes
FreeBSD user/group support has been added
The configuration system has been rewritten so that daemons can now generate
and repair the files and directories they need. (Fixed bug #68.)
Fixed the element override issues; now only subclasses can override values.
0.13.5
Fixed packages so types can be specified
Added 'enable' state to services, although it does not work everywhere yet
0.13.4
A few important bug fixes, mostly in the parser.
0.13.3
Changed transactions to be one-stage instead of two
Changed all types to use self[:name] instead of self.name, to support
the symbolic naming implemented in 0.13.1
0.13.2
Changed package[answerfile] to package[adminfile], and added package[responsefile]
Fixed a bunch of internal functions to behave more consistently and usefully
0.13.1
Fixed RPM spec files to create puppet user and group (lutter)
Fixed crontab reading and writing (luke)
Added symbolic naming in the language (luke)
0.13.0
Added support for configuration files.
Even more bug fixes, including the infamous 'frozen object' bug, which was a
problem with 'waitforcert'.
David Lutterkort got RPM into good shape.
0.12.0
Added Scheduling, and many bug fixes, of course.
0.11.2
Fixed bugs related to specifying arrays of requirements
Fixed a key bug in retrieving checksums
Fixed lots of usability bugs
Added 'fail' methods that automatically add file and line info when possible,
and converted many errors to use that method
0.11.1
Fixed bug with recursive copying with 'ignore' set.
Added OpenBSD package support.
0.11.0
Added 'ensure' state to many elements.
Modified puppetdoc to correctly handle indentation and such.
Significantly rewrote much of the builtin documentation to take advantage
of the new features in puppetdoc, including many examples.
0.10.2
Added SMF support
Added autorequire functionality, with specific support for exec and file
Exec elements autorequire any mentioned files, including the scripts,
along with their CWDs.
Files autorequire any parent directories.
Added 'alias' metaparam.
Fixed dependencies so they don't depend on file order.
0.10.1
Added Solaris package support and changed puppetmasterd to run as
a non-root user.
0.10.0
Significant refactoring of how types, states, and parameters work, including
breaking out parameters into a separate class. This refactoring did not
introduce much new functionality, but made extension of Puppet significantly
easier
Also, fixed the bug with 'waitforcert' in puppetd.
0.9.4
Small fix to wrap the StatusServer class in the checks for required classes.
0.9.3
Fixed some significant bugs in cron job management.
0.9.2
Second Public Beta
0.9.0
First Public Beta
diff --git a/lib/puppet/parser/resource/reference.rb b/lib/puppet/parser/resource/reference.rb
index 1dd816093..6e70d23b7 100644
--- a/lib/puppet/parser/resource/reference.rb
+++ b/lib/puppet/parser/resource/reference.rb
@@ -1,79 +1,85 @@
require 'puppet/resource_reference'
# A reference to a resource. Mostly just the type and title.
class Puppet::Parser::Resource::Reference < Puppet::ResourceReference
include Puppet::Util::MethodHelper
include Puppet::Util::Errors
attr_accessor :builtin, :file, :line, :scope
# Are we a builtin type?
def builtin?
unless defined? @builtin
if builtintype()
@builtin = true
else
@builtin = false
end
end
@builtin
end
def builtintype
if t = Puppet::Type.type(self.type.downcase) and t.name != :component
t
else
nil
end
end
# Return the defined type for our obj. This can return classes,
# definitions or nodes.
def definedtype
unless defined? @definedtype
case self.type
when "Class": # look for host classes
if self.title == :main
tmp = @scope.findclass("")
else
tmp = @scope.findclass(self.title)
end
when "Node": # look for node definitions
tmp = @scope.parser.nodes[self.title]
else # normal definitions
# We have to swap these variables around so the errors are right.
tmp = @scope.finddefine(self.type)
end
if tmp
@definedtype = tmp
else
fail Puppet::ParseError, "Could not find resource '%s'" % self
end
end
@definedtype
end
def initialize(hash)
set_options(hash)
requiredopts(:type, :title)
end
def to_ref
- return [type.to_s,title.to_s]
+ # We have to return different cases to provide backward compatibility
+ # from 0.24.x to 0.23.x.
+ if builtin?
+ return [type.to_s.downcase, title.to_s]
+ else
+ return [type.to_s, title.to_s]
+ end
end
def typeclass
unless defined? @typeclass
if tmp = builtintype || definedtype
@typeclass = tmp
else
fail Puppet::ParseError, "Could not find type %s" % self.type
end
end
@typeclass
end
end
diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb
index 24b70d088..e7385f796 100755
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@ -1,70 +1,75 @@
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../../spec_helper'
describe Puppet::Parser::Resource::Reference do
before do
@type = Puppet::Parser::Resource::Reference
end
it "should require a type" do
proc { @type.new(:title => "yay") }.should raise_error(Puppet::DevError)
end
it "should require a title" do
proc { @type.new(:type => "file") }.should raise_error(Puppet::DevError)
end
it "should know when it refers to a builtin type" do
ref = @type.new(:type => "file", :title => "/tmp/yay")
ref.builtin?.should be_true
ref.builtintype.should equal(Puppet::Type.type(:file))
end
- it "should return a relationship-style resource reference when asked" do
+ it "should return a downcased relationship-style resource reference for defined types" do
ref = @type.new(:type => "file", :title => "/tmp/yay")
- ref.to_ref.should == ["File", "/tmp/yay"]
+ ref.to_ref.should == ["file", "/tmp/yay"]
+ end
+
+ it "should return a capitalized relationship-style resource reference for defined types" do
+ ref = @type.new(:type => "whatever", :title => "/tmp/yay")
+ ref.to_ref.should == ["Whatever", "/tmp/yay"]
end
it "should return a resource reference string when asked" do
ref = @type.new(:type => "file", :title => "/tmp/yay")
ref.to_s.should == "File[/tmp/yay]"
end
it "should canonize resource references" do
ref = @type.new(:type => "foo::bar", :title => "/tmp/yay")
ref.to_s.should == "Foo::Bar[/tmp/yay]"
end
end
describe Puppet::Parser::Resource::Reference, " when modeling defined types" do
before do
@type = Puppet::Parser::Resource::Reference
@parser = Puppet::Parser::Parser.new :Code => ""
@definition = @parser.newdefine "mydefine"
@class = @parser.newclass "myclass"
@nodedef = @parser.newnode("mynode")[0]
@node = Puppet::Node.new("yaynode")
@compile = Puppet::Parser::Compile.new(@node, @parser)
end
it "should be able to find defined types" do
ref = @type.new(:type => "mydefine", :title => "/tmp/yay", :scope => @compile.topscope)
ref.builtin?.should be_false
ref.definedtype.should equal(@definition)
end
it "should be able to find classes" do
ref = @type.new(:type => "class", :title => "myclass", :scope => @compile.topscope)
ref.builtin?.should be_false
ref.definedtype.should equal(@class)
end
it "should be able to find nodes" do
ref = @type.new(:type => "node", :title => "mynode", :scope => @compile.topscope)
ref.builtin?.should be_false
ref.definedtype.object_id.should == @nodedef.object_id
end
end
diff --git a/test/language/resource.rb b/test/language/resource.rb
index 9c030d34a..84a30b029 100755
--- a/test/language/resource.rb
+++ b/test/language/resource.rb
@@ -1,493 +1,493 @@
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../lib/puppettest'
require 'puppettest'
require 'puppettest/resourcetesting'
class TestResource < PuppetTest::TestCase
include PuppetTest
include PuppetTest::ParserTesting
include PuppetTest::ResourceTesting
Parser = Puppet::Parser
AST = Parser::AST
Resource = Puppet::Parser::Resource
Reference = Puppet::Parser::Resource::Reference
def setup
super
Puppet[:trace] = false
end
def teardown
mocha_verify
end
def test_initialize
args = {:type => "resource", :title => "testing",
:scope => mkscope}
# Check our arg requirements
args.each do |name, value|
try = args.dup
try.delete(name)
assert_raise(ArgumentError, "Did not fail when %s was missing" % name) do
Parser::Resource.new(try)
end
end
res = nil
assert_nothing_raised do
res = Parser::Resource.new(args)
end
ref = res.instance_variable_get("@ref")
assert_equal("Resource", ref.type, "did not set resource type")
assert_equal("testing", ref.title, "did not set resource title")
end
def test_merge
res = mkresource
other = mkresource
# First try the case where the resource is not allowed to override
res.source = "source1"
other.source = "source2"
other.source.expects(:child_of?).with("source1").returns(false)
assert_raise(Puppet::ParseError, "Allowed unrelated resources to override") do
res.merge(other)
end
# Next try it when the sources are equal.
res.source = "source3"
other.source = res.source
other.source.expects(:child_of?).with("source3").never
params = {:a => :b, :c => :d}
other.expects(:params).returns(params)
res.expects(:override_parameter).with(:b)
res.expects(:override_parameter).with(:d)
res.merge(other)
# And then parentage is involved
other = mkresource
res.source = "source3"
other.source = "source4"
other.source.expects(:child_of?).with("source3").returns(true)
params = {:a => :b, :c => :d}
other.expects(:params).returns(params)
res.expects(:override_parameter).with(:b)
res.expects(:override_parameter).with(:d)
res.merge(other)
end
# the [] method
def test_array_accessors
res = mkresource
params = res.instance_variable_get("@params")
assert_nil(res[:missing], "Found a missing parameter somehow")
params[:something] = stub(:value => "yay")
assert_equal("yay", res[:something], "Did not correctly call value on the parameter")
res.expects(:title).returns(:mytitle)
assert_equal(:mytitle, res[:title], "Did not call title when asked for it as a param")
end
# Make sure any defaults stored in the scope get added to our resource.
def test_add_defaults
res = mkresource
params = res.instance_variable_get("@params")
params[:a] = :b
res.scope.expects(:lookupdefaults).with(res.type).returns(:a => :replaced, :c => :d)
res.expects(:debug)
res.send(:add_defaults)
assert_equal(:d, params[:c], "Did not set default")
assert_equal(:b, params[:a], "Replaced parameter with default")
end
def test_finish
res = mkresource
res.expects(:add_overrides)
res.expects(:add_defaults)
res.expects(:add_metaparams)
res.expects(:validate)
res.finish
end
# Make sure we paramcheck our params
def test_validate
res = mkresource
params = res.instance_variable_get("@params")
params[:one] = :two
params[:three] = :four
res.expects(:paramcheck).with(:one)
res.expects(:paramcheck).with(:three)
res.send(:validate)
end
def test_override_parameter
res = mkresource
params = res.instance_variable_get("@params")
# There are three cases, with the second having two options:
# No existing parameter.
param = stub(:name => "myparam")
res.send(:override_parameter, param)
assert_equal(param, params["myparam"], "Override was not added to param list")
# An existing parameter that we can override.
source = stub(:child_of? => true)
# Start out without addition
params["param2"] = stub(:source => :whatever)
param = stub(:name => "param2", :source => source, :add => false)
res.send(:override_parameter, param)
assert_equal(param, params["param2"], "Override was not added to param list")
# Try with addition.
params["param2"] = stub(:value => :a, :source => :whatever)
param = stub(:name => "param2", :source => source, :add => true, :value => :b)
param.expects(:value=).with([:a, :b])
res.send(:override_parameter, param)
assert_equal(param, params["param2"], "Override was not added to param list")
# And finally, make sure we throw an exception when the sources aren't related
source = stub(:child_of? => false)
params["param2"] = stub(:source => :whatever, :file => :f, :line => :l)
old = params["param2"]
param = stub(:name => "param2", :source => source, :file => :f, :line => :l)
assert_raise(Puppet::ParseError, "Did not fail when params conflicted") do
res.send(:override_parameter, param)
end
assert_equal(old, params["param2"], "Param was replaced irrespective of conflict")
end
def test_set_parameter
res = mkresource
params = res.instance_variable_get("@params")
# First test the simple case: It's already a parameter
param = mock('param')
param.expects(:is_a?).with(Resource::Param).returns(true)
param.expects(:name).returns("pname")
res.send(:set_parameter, param)
assert_equal(param, params["pname"], "Parameter was not added to hash")
# Now the case where there's no value but it's not a param
param = mock('param')
param.expects(:is_a?).with(Resource::Param).returns(false)
assert_raise(ArgumentError, "Did not fail when a non-param was passed") do
res.send(:set_parameter, param)
end
# and the case where a value is passed in
param = stub :name => "pname", :value => "whatever"
Resource::Param.expects(:new).with(:name => "pname", :value => "myvalue", :source => res.source).returns(param)
res.send(:set_parameter, "pname", "myvalue")
assert_equal(param, params["pname"], "Did not put param in hash")
end
def test_paramcheck
# There are three cases here:
# It's a valid parameter
res = mkresource
ref = mock('ref')
res.instance_variable_set("@ref", ref)
klass = mock("class")
ref.expects(:typeclass).returns(klass).times(4)
klass.expects(:validattr?).with("good").returns(true)
assert(res.send(:paramcheck, :good), "Did not allow valid param")
# It's name or title
klass.expects(:validattr?).with("name").returns(false)
assert(res.send(:paramcheck, :name), "Did not allow name")
klass.expects(:validattr?).with("title").returns(false)
assert(res.send(:paramcheck, :title), "Did not allow title")
# It's not actually allowed
klass.expects(:validattr?).with("other").returns(false)
res.expects(:fail)
ref.expects(:type)
res.send(:paramcheck, :other)
end
def test_to_transobject
# First try translating a builtin resource. Make sure we use some references
# and arrays, to make sure they translate correctly.
source = mock("source")
scope = mkscope
scope.stubs(:tags).returns([])
refs = []
4.times { |i| refs << Puppet::Parser::Resource::Reference.new(:title => "file%s" % i, :type => "file") }
res = Parser::Resource.new :type => "file", :title => "/tmp",
:source => source, :scope => scope,
:params => paramify(source, :owner => "nobody", :group => %w{you me},
:require => refs[0], :ignore => %w{svn},
:subscribe => [refs[1], refs[2]], :notify => [refs[3]])
obj = nil
assert_nothing_raised do
obj = res.to_trans
end
assert_instance_of(Puppet::TransObject, obj)
assert_equal(obj.type, res.type.downcase)
assert_equal(obj.name, res.title)
# TransObjects use strings, resources use symbols
assert_equal("nobody", obj["owner"], "Single-value string was not passed correctly")
assert_equal(%w{you me}, obj["group"], "Array of strings was not passed correctly")
assert_equal("svn", obj["ignore"], "Array with single string was not turned into single value")
- assert_equal(["File", refs[0].title], obj["require"], "Resource reference was not passed correctly")
- assert_equal([["File", refs[1].title], ["File", refs[2].title]], obj["subscribe"], "Array of resource references was not passed correctly")
- assert_equal(["File", refs[3].title], obj["notify"], "Array with single resource reference was not turned into single value")
+ assert_equal(["file", refs[0].title], obj["require"], "Resource reference was not passed correctly")
+ assert_equal([["file", refs[1].title], ["file", refs[2].title]], obj["subscribe"], "Array of resource references was not passed correctly")
+ assert_equal(["file", refs[3].title], obj["notify"], "Array with single resource reference was not turned into single value")
end
# FIXME This isn't a great test, but I need to move on.
def test_to_transbucket
bucket = mock("transbucket")
source = mock("source")
scope = mkscope
res = Parser::Resource.new :type => "mydefine", :title => "yay",
:source => source, :scope => scope
result = res.to_trans
assert_equal("yay", result.name, "did not set bucket name correctly")
assert_equal("Mydefine", result.type, "did not set bucket type correctly")
end
def test_evaluate
# First try the most common case, we're not a builtin type.
res = mkresource
ref = res.instance_variable_get("@ref")
type = mock("type")
ref.expects(:definedtype).returns(type)
res.expects(:finish)
res.scope = mock("scope")
config = mock("config")
res.scope.expects(:compile).returns(config)
config.expects(:delete_resource).with(res)
args = {:scope => res.scope, :resource => res}
type.expects(:evaluate).with(args)
res.evaluate
end
def test_add_overrides
# Try it with nil
res = mkresource
res.scope = mock('scope')
config = mock("config")
res.scope.expects(:compile).returns(config)
config.expects(:resource_overrides).with(res).returns(nil)
res.expects(:merge).never
res.send(:add_overrides)
# And an empty array
res = mkresource
res.scope = mock('scope')
config = mock("config")
res.scope.expects(:compile).returns(config)
config.expects(:resource_overrides).with(res).returns([])
res.expects(:merge).never
res.send(:add_overrides)
# And with some overrides
res = mkresource
res.scope = mock('scope')
config = mock("config")
res.scope.expects(:compile).returns(config)
returns = %w{a b}
config.expects(:resource_overrides).with(res).returns(returns)
res.expects(:merge).with("a")
res.expects(:merge).with("b")
res.send(:add_overrides)
assert(returns.empty?, "Did not clear overrides")
end
def test_proxymethods
res = Parser::Resource.new :type => "evaltest", :title => "yay",
:source => mock("source"), :scope => mkscope
assert_equal("Evaltest", res.type)
assert_equal("yay", res.title)
assert_equal(false, res.builtin?)
end
def test_reference_conversion
# First try it as a normal string
ref = Parser::Resource::Reference.new(:type => "file", :title => "/tmp/ref1")
# Now create an obj that uses it
res = mkresource :type => "file", :title => "/tmp/resource",
:params => {:require => ref}
res.scope = mkscope
trans = nil
assert_nothing_raised do
trans = res.to_trans
end
assert_instance_of(Array, trans["require"])
- assert_equal(["File", "/tmp/ref1"], trans["require"])
+ assert_equal(["file", "/tmp/ref1"], trans["require"])
# Now try it when using an array of references.
two = Parser::Resource::Reference.new(:type => "file", :title => "/tmp/ref2")
res = mkresource :type => "file", :title => "/tmp/resource2",
:params => {:require => [ref, two]}
res.scope = mkscope
trans = nil
assert_nothing_raised do
trans = res.to_trans
end
assert_instance_of(Array, trans["require"][0])
trans["require"].each do |val|
assert_instance_of(Array, val)
- assert_equal("File", val[0])
+ assert_equal("file", val[0])
assert(val[1] =~ /\/tmp\/ref[0-9]/,
"Was %s instead of the file name" % val[1])
end
end
# This is a bit of a weird one -- the user should not actually know
# that components exist, so we want references to act like they're not
# builtin
def test_components_are_not_builtin
ref = Parser::Resource::Reference.new(:type => "component", :title => "yay")
assert_nil(ref.builtintype, "Definition was considered builtin")
end
# The second part of #539 - make sure resources pass the arguments
# correctly.
def test_title_with_definitions
parser = mkparser
define = parser.newdefine "yayness",
:code => resourcedef("file", "/tmp",
"owner" => varref("name"), "mode" => varref("title"))
klass = parser.findclass("", "")
should = {:name => :owner, :title => :mode}
[
{:name => "one", :title => "two"},
{:title => "three"},
].each do |hash|
config = mkcompile parser
args = {:type => "yayness", :title => hash[:title],
:source => klass, :scope => config.topscope}
if hash[:name]
args[:params] = {:name => hash[:name]}
else
args[:params] = {} # override the defaults
end
res = nil
assert_nothing_raised("Could not create res with %s" % hash.inspect) do
res = mkresource(args)
end
assert_nothing_raised("Could not eval res with %s" % hash.inspect) do
res.evaluate
end
made = config.topscope.findresource("File[/tmp]")
assert(made, "Did not create resource with %s" % hash.inspect)
should.each do |orig, param|
assert_equal(hash[orig] || hash[:title], made[param],
"%s was not set correctly with %s" % [param, hash.inspect])
end
end
end
# part of #629 -- the undef keyword. Make sure 'undef' params get skipped.
def test_undef_and_to_hash
res = mkresource :type => "file", :title => "/tmp/testing",
:source => mock("source"), :scope => mkscope,
:params => {:owner => :undef, :mode => "755"}
hash = nil
assert_nothing_raised("Could not convert resource with undef to hash") do
hash = res.to_hash
end
assert_nil(hash[:owner], "got a value for an undef parameter")
end
# #643 - Make sure virtual defines result in virtual resources
def test_virtual_defines
parser = mkparser
define = parser.newdefine("yayness",
:code => resourcedef("file", varref("name"),
"mode" => "644"))
config = mkcompile(parser)
res = mkresource :type => "yayness", :title => "foo", :params => {}, :scope => config.topscope
res.virtual = true
result = nil
assert_nothing_raised("Could not evaluate defined resource") do
result = res.evaluate
end
scope = res.scope
newres = scope.findresource("File[foo]")
assert(newres, "Could not find resource")
assert(newres.virtual?, "Virtual defined resource generated non-virtual resources")
# Now try it with exported resources
res = mkresource :type => "yayness", :title => "bar", :params => {}, :scope => config.topscope
res.exported = true
result = nil
assert_nothing_raised("Could not evaluate exported resource") do
result = res.evaluate
end
scope = res.scope
newres = scope.findresource("File[bar]")
assert(newres, "Could not find resource")
assert(newres.exported?, "Exported defined resource generated non-exported resources")
assert(newres.virtual?, "Exported defined resource generated non-virtual resources")
end
# Make sure tags behave appropriately.
def test_tags
scope_resource = stub 'scope_resource', :tags => %w{srone srtwo}
scope = stub 'scope', :resource => scope_resource
resource = Puppet::Parser::Resource.new(:type => "file", :title => "yay", :scope => scope, :source => mock('source'))
# Make sure we get the scope resource's tags, plus the type and title
%w{srone srtwo yay file}.each do |tag|
assert(resource.tags.include?(tag), "Did not tag resource with %s" % tag)
end
# make sure we can only set legal tags
["an invalid tag", "-anotherinvalid", "bad*tag"].each do |tag|
assert_raise(Puppet::ParseError, "Tag #{tag} was considered valid") do
resource.tag tag
end
end
# make sure good tags make it through.
tags = %w{good-tag yaytag GoodTag another_tag a ab A}
tags.each do |tag|
assert_nothing_raised("Tag #{tag} was considered invalid") do
resource.tag tag
end
end
# make sure we get each of them.
ptags = resource.tags
tags.each do |tag|
assert(ptags.include?(tag.downcase), "missing #{tag}")
end
end
end

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 1, 8:59 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10075410
Default Alt Text
(58 KB)

Event Timeline