Age | Commit message (Collapse) | Author | Files | Lines |
|
When Puppet::Util::Execution.execute was changed to return a subtype of
String in order to retain return code information, some callers ended up
breaking. This is because they made the assertion that types were
exactly the String class, rather than a subtype of String. There is also
the issue that only the primitive data structures should probably be
returned from puppet functions in order to not leak complex objects into
the puppet language and have hard to track down issues arise.
This changes the generate() function to force it to return a String of
the command's output.
|
|
(PUP-2101) resource parser: add the resource name on the validation e…
|
|
message when using create_resources
|
|
The tests were often creating environments that didn't need to have
manifests. Since we didn't have a way of specifying that when they
were written, we used '' to fill in the blank. This actually caused a
large number of tests to try to find code to load in the PWD, which
caused tests to break if a developer had parse errors in manifests being
used for testing in the root directory of their puppet project. This
changes the manifest to be optional and removes '' from those tests. The
tests no longer fail if a bad manifest is in the PWD :D
|
|
If a block is given in <%= {} %> the block should be evaluated, and
what it produces should be rendered. This commit makes this possible
by:
* explicitly handle the render block case
* allowing {} to be validated as r-value producing
|
|
|
|
|
|
|
|
|
|
|
|
The original Puppet::Parser::Functions defined() checked whether a class
or resource type had been defined, or a particular resource reference
declared. We've extended this to allow for checking variable
assignment, by looking up a string reference for the variable name.
This version can also look up defined classes, types and resources by
type reference if the future parser is in effect.
Paired with Henrik Lindberg <henrik.lindberg@puppetlabs.com>
|
|
|
|
The map function only supported a single argument which made it
impossible to map based on index in an Array, and made in awkward
to map on only hash key or value.
Now the map function accepts either value (as before), or index/value,
or key/value (for hash).
|
|
This adds use of the common Enumeration support to the slice function.
The documentation of the function is also updated.
|
|
This makes the map function use the common Enumeration support.
|
|
This makes the filter function use the common Enumeration support
and makes it consistent with how all iterative functions should behave.
The function's documentation is also updated.
|
|
Instead of creating environments directly, we need to go through the
configured environment loaders, otherwise environments can't come from
other places.
|
|
And adjust TestHelper initialization to preserve base context setup
without requiring settings initialization in before_all_tests hook.
Initializing settings in the before_all_tests was causing a slowdown
somewhere in call_hooks_deferred_to_application_initialization.
The issue came from the root environment needing to have the modulepath,
which interpolates in the confdir to produce the value. However,
after an initial run, the after each hook tears down the settings, which
makes them unavailable in the second before all call. This problem had
been masked previously because of the way the root environment was
cached and not reset between tests.
|
|
hlindberg/pup-1166_better-error-for-strict-var-lookup
(PUP-1166) Add better error for 3x --strict_variables
|
|
When turning on --strict_variables without also using --future parser
with the future evaluator, the raised error is an uncaught throw.
Now the error message is "Undefined Variable".
|
|
Commented out code was testing removed behavior. Removed comments.
|
|
This moves the global context handling out of the Puppet::Context class
and onto the Puppet module, which allows Puppet::Context to be a more
generic, overridable context system. It also allows references to
context information to be a little bit shorter.
This doesn't tackle making settings information available in the
context, and so there might be a little confusion between Puppet[] and
Puppet.lookup.
|
|
One does not simply change the current environment!
This replaces use of Environment.current= and Environment.current with
Puppet::Context.lookup(:current_environment). This uncovered a lot of
assumptions about what the current environment is at various times, such
as during startup before initialization. There is now a "bootstrap"
context that is setup as soon as possible which provides a basic setup,
once initialization occures this is overridden with another context that
is able to do more.
|
|
After trying to get the manifest and modulepath during the
initialization for an environment, it turned out that a lot of other
things depended on a very specific load order. Some of those needed to
change around, others needed to delay executing until later, after
everything had been loaded and initialized (creation of the root
environment was one of these). The reset of the Parser::Functions also
moved so that it doesn't happen until settings have been initialized.
|
|
hlindberg/pup-716_short-lived-objects-in-filesystem
(PUP-716) short lived objects in filesystem
|
|
|
|
There were several issues with the implementation of location
handling - primarily missing the ability to be able to
serialize/de-serialize the model with retained positioning information.
This changes the design to bring the two values offset and length
into each model object and that location information is recored in
the top level Program construct. With this change a Program is
always returned as the result of a parse.
The change touches many files, due to the change to always return
a Model::Program. Most of the change is removal of now no longer
needed constructs.
|
|
|
|
Setting up the initial injector, as well as creating an override
required quite a bit of gymnastics. This is now made much simpler.
The Injector now has class methods create, create_from_model, and
create_from_hash. The instance has override, override_with_model,
override_with_hash.
|
|
This removes the ability to define categories and use
predicated bindings. Instead, all contributors should evaluate
predicates and only contribute applicable bindings.
This reduces the complexity of the binder.
The support for predicated bindings was only there to support
the now removed experimental "hiera2-data-in-modules"
|
|
(PUP-546) remove hiera2 part of data in modules
|
|
- Files were created without going through tmpfile as they needed
specific extensions
|
|
Moved lookup functionality to separate helper class.
|
|
With removed hiera2, the lookup function is not as useful and is
now replaced with the lookup from (#22574) which first looks in
bound data and then in hiera.
The intent is to use the technolgy agnostic "lookup" in the future
parser/evaluator to enable shorthand notation. The actual lookup
mechanism/technology is thereby not visible to the user.
|
|
This adds support for iterating / slicing an enumerable type (Integer
range).
This also corrects the size calculation done in Integer range (off
by one since it is an end inclusive range).
|
|
This adds support to iterate / map an enumerable type (Integer range).
|
|
This adds support to perform reduce on an enumerable type (Integer
range).
This also corrects a typo in an error message (said 'collect' instead
of 'reduce').
|
|
This adds the ability to filter the sequence of elements produced
by an enumerable type (just like for array and hash).
|
|
This adds a deprecation warning to operations that mutates array
and hash - i.e. $a = [1,2,4] $a[3] = 5, and equivalent for hash.
The warning message has a URL that leads to PUP-864.
Existing tests that test that mutation is possible now also checks
that a warning is issued.
|
|
This deprecates the use of import.
A deprecation warning is generated with a URL to a link that in
turn points to the original Redmine issue.
A test is added.
Note this does not deprecate the underlying "import" mechanism as it is
used for all types of loading of manifests. The deprecation is for
the puppet language construct.
|
|
Collect/map was renamed, but there were tests that still used
collect. One test was broken in map_spec.rb (due to fix of undef/nil
problem that was missed in rename/merge/rebase).
|
|
This removes several unused methods and attributes from
Puppet::Parser::Scope. The only places in code using them where tests.
It also removes some "convenience"/"proxy" methods used by only the
Collector (better for it to do this on its own than cluttering
the Scope implementation)
Also refactors creating scopes for the purpose of running tests by
moving that logic from Scope to PuppetSpec::Scope that should be
included in examples to use the no(now renamed) method
Useless and tests that test that scope behaves the wrong ! way removed.
(It is always illegal to set match data variables from anything but a
match, but this functionality was tested by spec tests).
It was then much clearer how match scope and local scope should work.
Now a LocalScope always have a nested MatchScope that is transparent
until a match is set, or a nested MatchScope is created for an inner
scope. This enables rewriting the evaluator logic to not leak match
scopes where there is a sequence of matches at top level in a define or
class body.
|
|
The method was only used from scope_spec.rb
|
|
Scope only performed partial shadowing of match variables. This was
caused by a search of missing numeric variables in outer scopes.
This commit changes that by making the most nested match scope
authoritative wrt numerical variables. It also changes the scope to use
individually stored variables to simply looking them up in the match
data that is used to construct the match scope.
The scope_spec is changed to test for this. Some other tests changes as
a consequence of the internal refactor.
|
|
(#23115) Convert nil resource parameter values to undef.
|
|
- Windows symlink support has been added to exist?, symlink, symlink?,
readlink, stat, and lstat. This overrides any usage of Ruby File or
FileTest classes which are completely borked on Windows.
- :manages_symlinks feature of the file provider is enabled with a
check against Puppet.features.manages_symlinks? which checks for the
existence of the CreateSymbolicLink call in kernel32.dll
- FFI wrappers for Win32 API calls CreateSymbolicLink, CreateFile,
GetFileAttributes, DeviceIoControl and CloseHandle added to
windows/file
NOTE: The DeviceIoControl method of resolving symlinks was used
instead of GetFinalPathNameByHandle, which is known to misbehave
with UNC paths
- Any tests against :manages_symlinks feature are automatically turned
on for Windows, increasing test count by approximately 42 new tests
- Removed a few symlink tests that were confined to any OS other than
Windows since they must now be adjusted to run on Windows versions
that we know support symlinks
- Updated symlink documentation based on ileUtils.symlink behavior
|
|
If a resource parameter evaluates to nil (e.g. a return value from a parser
function), then convert the value to undef. This prevents an error in
Puppet::Parser::Resource::Param which requires a non-nil value on
instantiation.
|
|
When a 'devfail' or Puppet::DevError is thrown, include the user's manifest
file/line context as it can help in finding the problem.
|
|
Classes Puppet::Parser::AST::ResourceParam and Puppet::Parser::Resource::Param
|
|
Iristyle/ticket/master/19447-windows-symlinks-1-abstraction
(#19447) Phase one, manages_symlinks feature, FileSystem abstraction
|