Age | Commit message (Collapse) | Author | Files | Lines |
|
The lookup function only works when the future parser is in effect. This
changes the spec tests to turn on the future parser.
|
|
This adds checks for the specification's assertions that virutal and
exported resources are not in the produced catalog, but are available
for later operations (realization) and reference (reading a parameter
value). This cannot check that the exported resources are made available
to catalog processors, since that is implementation dependent.
In order to check this the compile_to_catalog method needed to be
changed to filter out expoerted resources, just like the catalog
indirection does. This required a change to the create_resources test.
|
|
I believe most of these predated our clearing the settings before each
test in the central puppet/test/test_helper.rb. And since we then set
some base settings (such as :environment_timeout) in the test_helper,
the effect of a secondary clear in the test itself is to wipe out the
baseline setup test_helper just laid down.
In particular this is a problem with environment_timeout, as it leads to
tests which end up creating environments, getting them cached with the
default 180s timeout, which can leak to subsequent tests and create
unpleasant spec order issues.
|
|
Testing that the function exists isn't really needed since the later
tests that actually use the function will find that fairly quickly.
|
|
This modifies the file() function to accept module paths (like the
template() function) as well as fully qualified paths.
This makes it possible for modules that use the file() function
to be more portable, instead of being tied to a specific puppet
server configuration.
Example
with directory structure:
/etc/puppet/modules/example
├── files
│ └──file.ext
├── manifests
│ └──init.pp
└── templates
└──template.erb
When the module path for files can be used instead of the absolute
path:
file('example/file.ext') returns the same as
file('/etc/puppet/modules/example/files/file.ext').
This is supposed to be like how template does module paths, where:
template('example/template.erb') returns the same as
template('/etc/puppet/modules/example/templates/template.erb')
|
|
The realize() spec tests didn't really do much since they mocked out so
close to the function itself. This calls it in a manner that puts
resources in the catalog and checks that they are there.
The accpetance tests for the realize function are no longer needed.
|
|
This moves the function inline_epp to use the new function API.
This also improves the argument checking since it is not not possible
to leak non variable name compliant variables into the scope.
|
|
This moves the epp function to the new function API.
The type checking is much approved as a consequence as the function
is now protected against spilling non variable name compliant
variables into the scope.
|
|
(PUP-1852) Deprecate the 'search' function.
|
|
(PUP-1100) Fix error message with create_resource and auto-loaded class
|
|
jaredjennings/feature/master/pup-2511-digest-parser-function
(PUP-2511) Add parser function digest: uses digest_algorithm to hash, not strictly md5
|
|
EPP, because it uses named parameters, does not support using slurped
(captures rest) parameters. This adds a static check to catch that being
done.
|
|
This adds type checking to the call_by_name invocation of closures,
which is used for EPP templates. There is a pending test for issuing an
error for slurp parameters in EPP templates.
|
|
This commit adds a check for the create_resources syntax error message.
If there is a syntax error, the error given by puppet master is unclear.
This commits adds a test to check that the error message is correct and
makes sense.
This only happens when the resources are auto imported, which is why I
use a fixture directory.
|
|
(PUP-121) remove relative name spacing
|
|
When the 3x to 4x calls take place, resource references in the form
of a PCatalogEntryType are transformed to Puppet::Resource.
Depending on where these (reference) Puppet::Resource instances are
used they need to either be absolute, or not (yes, 3x is inconsistent).
Since future parser in 3.7 (and later 4.0) will not support dynamic
name scoping, the PCatalogEntryType's should in general be absolute.
This commit changes the transformation to make the created
Puppet::Resource (references) absolute (when it is possible).
This also adds more tests
|
|
This function is deprecated because support for dynamic scoping
has been removed in general and this function makes it possible
to abuse the systems ability to search multiple disjunct name-spaces.
|
|
This makes the examples that test include, require, contain
share the same tests.
This also adds one missing error condition.
|
|
* upstream/stable:
(PUP-2584) Make 404 warning on agent specific and an error.
(PUP-1894) Fix issue with loading EPP from modules
Conflicts:
lib/puppet/configurer.rb
Resolved, merging in stable's :fail_on_404 option into the node
indirection request, and keeping master's changes to set a remote env in
the node in the likely case that locally there is no matching directory
env.
|
|
The problem when loading EPP was that the name of the environment was
passed instead of the actual environment (which was expected).
This simply changes this, and adds a test that an epp can be loaded from
a module.
|
|
This generalizes the "make names absolute" to a transformation
of given arguments to class names strings suitable for lookup, and
also applying the transformation to Class and Resource reference types.
|
|
This makes include, require, and contain functions transform
relative names to absolute names before doing any lookup.
The transformation is controlled by a metho on scope that is
always called, and that performs the transformation when Puppet[:parser]
== future. This design was selected to ensure that there is one place to
later change (other flags, or in Puppet 4 when the future will
be something else).
|
|
zaphod42/issue/master/pup-1597-contain-is-just-wrong
(PUP-1597) Fix contain functions lookup of class with leading ::
|
|
The contain() function made an error when dealing with a relative name.
It assumed that the class that was actually included was always the same
as the name that it was given. In many cases this is true, but when the
name is found via a relative lookup (e.g. contain(bar) inside a class
foo, when a foo::bar exists), the assumption breaks down. The source of
the problem is that it tries to look up the included class after the
fact. Without all of the extra information about namespaces it isn't
able to find the right class.
To fix this, the include() function has been updated to return the
class resources that it included (including those that were already
present). This allows the contain() function to create the appriate
edges with the exact resources needed.
A secondary change in this was to remove the checks for include not
being able to include a class. The compiler method that is involved
already makes that check and raises an error, so the include functions
code was simply redundant.
|
|
This adds validation of non-productive expressions:
* when they do not appear last
* when they appear last in constructs that do not produce a value
|
|
When the contain function creates edges it looked up resources
without removing the leading :: in the name. The catalog never stores
these, and thus an edge was formed between a resource and nil.
This commit simply removes the ::. There is no checking that a resource
is actually returned since they should all be there due to the call to
include them in the catalog (which would fail if it was not possible to
include them).
A test is also added for the erronous (and now fixed case).
|
|
strictly md5
Puppet has an md5 parser function, which returns the MD5 digest of its
argument. On hosts configured for compliance with U.S. Federal
Information Processing Standard (FIPS) 140-2, attempts to use the MD5
algorithm cause errors, because MD5 is no longer FIPS Approved. This
patch adds a parser function called digest, which returns the digest
of its argument using the algorithm named by the digest_algorithm
setting in puppet.conf. Therefore, where md5 may fail on some hosts,
the digest function should always return a value; but the value may
vary if the digest_algorithm setting is changed.
|
|
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.
|
|
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>
|
|
|
|
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 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.
|
|
- 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
|
|
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.
|
|
(#8040) Add a 'contain' function
|