Age | Commit message (Collapse) | Author | Files | Lines |
|
- All previous File and FileTest calls to exist? or exists? go through
the new FileSystem::File abstraction so that the implementation can
later be swapped for a Windows specific one to support symlinks
|
|
(PE-455)
Previously, all classes specified by an ENC in parameterized format (a
hash from class to a hash of its parameters) would be evaluated as if
they had parameters. This causes a failure if the class is already
included elsewhere.
This also caused classes with empty parameters to conflict, just because
they happened to be sent as if they were parameterized. For ENCs which
always submit classes in the parameterized form, this causes strange
errors even though there isn't any real conflict, and substantially
diminishes the utility of the ENC.
With this change, ENC classes which have no parameters won't conflict
if they are already included. Classes which do have parameters continue
to conflict the same as they did before, as do classes which are
declared in Puppet code without parameters using resource syntax.
Conflicts:
spec/unit/parser/compiler_spec.rb
Resolved in favor of 64ff835, removing two specs which had been later
modified in favor of the introduced specs for 'when evaluating node
classes'.
|
|
improve tag performance
|
|
This removes the two alternative lambda syntax forms from the grammar
and changes (and removes) tests that were testing (or using) the
removed forms.
The two removed forms are:
* {|$x| }
* |$x| => { }
|
|
Conflicts:
spec/unit/parser/methods/collect_spec.rb
spec/unit/parser/methods/reject_spec.rb
spec/unit/parser/methods/select_spec.rb
|
|
|
|
Tags were being stored in an array, which is inefficient as the number of tags
grows. This commit changes Puppet::Util::Tagging to store tags in a set. A new
class is added, Puppet::Util::TagSet, which subclasses the built in set while
allowing it to be compatible with the old serialization format.
|
|
* Promote Puppet::Parser::Resource#to_resource to the
parent class, Puppet::Resource
* Cleanup in Puppet::Resource::Catalog#to_catalog:
** It was using dup to copy the resource, then (for this
issue) needing to nil-out the catalog. Now just
use copy_as_resource
** The conditional around which convert method to use
was more flexible (and thus confusing) than it needed
to be. Distilled to the two cases: to_resource vs to_ral
* Rename to_resource to copy_as_resource for clarity.
This required updating a number of unit tests.
|
|
* issues/issue-22785-rename-collect:
(Maint) Whitespace fixup
(#22785) Deprecate the collect function (by making it raise an error)
(#22785) Rename and update collect_spec to map_spec and use map
(#22785) Add map function (copy of collect)
|
|
Remove trailing whitespace.
|
|
* henrik/issues/issue-22729-remove-reject:
(#22729) Remove the reject function.
|
|
|
|
|
|
The iterative 'reject' function shadowed the stdlib function with the
same name. At the same time there was a decision to rename the 'select'
function to 'filter' (to use a name in the functional programming
languages family map/reduce/filter). The reject function was then
rejected [sic].
This commit removes the reject function and the corresponding tests. The
function was not used anywhere else in puppet logic or testing.
User documentation needs to be updated.
|
|
(#22740) create_resources input validation
|
|
Currently, Puppet's `create_resources()` function only validates that
the number of arguments. However, the function expects a hash for the
second argument, and Puppet explodes with an unhelpful error if the
second argument is not a hash, or nil.
For example, if the second argument is a string, you'll receive
something along the lines of `undefined method `each' for "":String at
/etc/puppetlabs/puppet/manifests/site.pp:45`. This is less than helpful
for users.
This patch raises an argument error if the second argument is not a
hash, warning the user that it should be.
Also adds input validation for optional third argument of create_resources,
and added a test to match.
|
|
This updates the test to use map instead of collect.
|
|
Tests updated to use the each function.
|
|
The each function should be used instead.
|
|
* upstream/stable:
(maint) Move constant outside shared_examples_for to avoid "already initialized" warning
(maint) Windows failing spec fixes
Conflicts:
spec/unit/node/environment_spec.rb
|
|
(#8040) Add a 'contain' function
|
|
|
|
If a class is contained twice in the same location, this is consistent but
should only create one edge.
|
|
This also includes some minor refactoring of the contain function.
|
|
- The usage of Dir.getwd in tests has been simplified to
File.expand_path to properly handle mixed case CWD
- util_spec.rb ensures 'FOO' Env var cleared before test starts
- Windows SID checks should be performed as a regex match to
properly handle all accounts starting with S-1-5-*, which denotes
accounts with an identifier authority of SECURITY_NT_AUTHORITY
instead of hardcoding S-1-5-32-544, the Administrators group
|
|
|
|
This adds the 'contain' function. When used inside of a class definition, it
will create a containment relationship such that the current class contains
the argument of 'contain'.
|
|
|
|
* maint/master/21201-remove-threading-code:
(#21201) Remove test for thread-safety
(#21201) Remove thread-safety code
(Maint) Remove whitespace errors
|
|
zaphod42/issue/master/21409-create_resources-differs-from-real-resource
(#21409) Ensure that create_resources acts the same as a resource decl
|
|
Puppet does not support running in any threaded environments. The thread
safety code that has been added has been, for the most part, haphazard
and not a holistic solution to the threading problem. There are many
areas that are not protected at all and others that were protected in
incomplete ways. The extra code and logic only caused more complication
in the codebase and is removed by this commit.
|
|
This ties the selection of the Puppet::Graph::Prioritizer to the
Puppet[:ordering] setting. In order to make it easier to ensure that all
of the uses of the prioritizer use the same one (because it needs to
track state) this also moves around the relationship of the catalog and
the transaction. Previously the catalog was responsible for converting
itself into a relationship graph. This now puts that responsibility on
the transaction, which much now be constructed with the desired
Prioritizer. The selection is still done in the catalog (because that is
where #apply lives, which is the public starting point of applying a
catalog).
Additionally this adds a random prioritizer.
|
|
* stable: (21 commits)
(packaging) Update PUPPETVERSION for 3.2.4
(maint) Correct type in speeeeling of pl-fedora-18-i386 mock in ext/build_defaults.yaml
(packaging) Move systemd BuildRequires into conditional
(Bug #21768) Update puppet for F19
(maint) Remove rspec requires from the Rakefile
(maint) Fix module_utils regex tests for module file perms
(maint) Fix windows test for embedded '..' in path
Improving testing around PMT module install permissions.
Ensure that PMT uses the correct group membership.
(#21971) Allow paths that contain .. as part of a name
Fixing a missed test for minitar.
(Maint) Reinstate check for manifest dir
(#21953) Add test to verify module permissions
(#14333) Ensure module permissions are sane.
(#21971) Fixes PathPattern's usage of Dir.glob for Windows
(#21971) Fix TypeLoader#import_all on Ruby 1.8.7
(#21971) Create system for safely dealing with path patterns
(#21971) Split import and autoloading code paths
(#21971) Check for possible directory traversal
(Maint) Clean up specs
...
|
|
3.2.4
* tag '3.2.4': (21 commits)
(packaging) Update PUPPETVERSION for 3.2.4
(maint) Correct type in speeeeling of pl-fedora-18-i386 mock in ext/build_defaults.yaml
(packaging) Move systemd BuildRequires into conditional
(Bug #21768) Update puppet for F19
(maint) Remove rspec requires from the Rakefile
(maint) Fix module_utils regex tests for module file perms
(maint) Fix windows test for embedded '..' in path
Improving testing around PMT module install permissions.
Ensure that PMT uses the correct group membership.
(#21971) Allow paths that contain .. as part of a name
Fixing a missed test for minitar.
(Maint) Reinstate check for manifest dir
(#21953) Add test to verify module permissions
(#14333) Ensure module permissions are sane.
(#21971) Fixes PathPattern's usage of Dir.glob for Windows
(#21971) Fix TypeLoader#import_all on Ruby 1.8.7
(#21971) Create system for safely dealing with path patterns
(#21971) Split import and autoloading code paths
(#21971) Check for possible directory traversal
(Maint) Clean up specs
...
Conflicts:
lib/puppet/parser/type_loader.rb
spec/unit/parser/type_loader_spec.rb
Conflicts were between changes Patrick Carlisle made in stable between
3.2.3..3331528, mostly refactoring the type_loader_spec to be
independent of parser implementation:
* 0c6060f Patrick Carlisle 5 weeks ago (maint) Refactor type_loader,
mostly specs
* 27a69f2 Patrick Carlisle 5 weeks ago (#21653) Skip modules with no
manifest directory when loading resource types
And the above security work.
|
|
(#16856) Add support for Data-in-Modules
|
|
The codepaths for import and autoloading of manifest files were combined
at many levels, which made them share behaviors that were not wanted.
The import ability to load absolute paths leaked through into how
autoloading would try to find files for a particular class name, which
resulted in a possible vulnerability to injected class names (ENC
values, hiera data, etc). This splits those code paths to ensure that
the one used for autoloading only will ever look in modules that are
registered on the modulepath, while still allowing the import path to
look at absolute and relative file paths.
|
|
(#22079) Fix HashArrayAccess produces :undef when value is false
|
|
It should naturally have produced false. The test for "having value" was
wrong and equated nil with false.
|
|
The lookup function test was missing because the setting --binder
was missing, and lookup only works when this feature is turned on).
|
|
The Puppet Binder a.k.a "Data-in-Modules" is based on Rgen, and is
required to be able to use the data-in-module/hiera2 features.
The setting :binder must be set to true, or :parser set to 'future' for
the bindings system, data-in-modules, and hiera2 to be in effect.
The bindings system is now "booted" by the compiler on demand if the
settings dictate this.
Implicit lookup of undefined class parameters will not use injector
unless active.
Explicit lookup using lookup will raise an error unless the bindings
system is active.
Tests toggle the activation
|
|
|
|
This adds the ability to call lookup with a lambda that gets the looked
up result for futher processing. The lambda gets undef when nothing was
found. This enables a convenient way to define a default when value is
missing.
|
|
The lookup() function can now enforce the type that the caller of the
function is expecting to receive by being provided a type specification
as a second argument. If no argument is provided it will default to
needing "Data", which is the supertype of all of the data types (Object
is a supertype, but doesn't not result in getting a looked up value
because the type is also part of a namespace for the injection system
and it holds object separate from data).
|
|
This adds implicit lookup of host class parameters via injector.
Checks DataBindings (i.e. Hiera) if there is no bound value.
Fixes tests that were mocking scope and did not expect calls to
compiler. Also adds accessor method that creates an injector if none was
created.
|
|
The lookup() function will use the configured bindings and injector to
lookup a value. If one is not found, then nil is returned (which is
undef in the puppet language). Any errors from the injector are
propogated out to the caller.
|
|
(#21252) Fix problems with false/nil args and returns in lambda
|
|
The behavior for an argument that was :undef (from an undefined
variable) and nil (from a function returning a nil in a data structure)
was different. This fixes that inconsistency by making them both the
same. It also clarifies that passing undef to a lambda does not result
in the default value for that parameter.
In addition some of the variables have been renamed to clarify their
purpose and extra code for a 1.8.7 difference that we were unable to
reproduce has been removed.
|
|
The issue 21252 was triggered by a documentation error but should
have produced a different result than the error that was presented.
This was caused by a series of problems. It was not possible to
pass `false` as a parameter value as this was taken as missing parameter
value.
Also, it was not possible to return the value `false` as this was
translated to `nil` due to defective work around for missing initialized
variable on return.
The fix changes the handling of making sure that the variable that is
returned exists (by setting value explicelty to `nil` before the start
of the exception handling block.
This commit also modifies how a lambda call matches arguments to
parameters and checks what is missing (now with `false` as a valid value
in mind).
A test is added to `collect` that checks that a value of `false` can
both be passed and returned.
|
|
This was a bad idea.
|
|
(#21508) Make local variables available to templates as instance vars
|