Age | Commit message (Collapse) | Author |
|
|
|
- `defined_with_params` calls `findresource(reference.to_s)`
- `findresource` is
https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/parser/compiler.rb#L407
and points to
https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L352
- This calls `Puppet::Resource.new` with the type
https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource/catalog.rb#L366
- This ends up calling `resource_type` via
https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L317-L319
and that ends up declaring the type via the autoloader api at
https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/resource.rb#L390
- But why does the autoloader API fail to find it in the current
environment?
- Okay, so when the autoloader is trying to find the type, it uses the
typeloader to look it up in the current environment
https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/metatype/manager.rb#L171
- this calls `get_file` and `mark_loaded`
https://github.com/puppetlabs/puppet/blob/4.8.1/lib/puppet/util/autoload.rb#L64-L67
Suggested workaround is to pass a literal type instead of a string to
`findresource` to fix in stdlib, and also to fix loading/requiring of
type in core puppet.
This seems to affect more recent versions of puppet, so fallback to
original behavior on pre-4.5
|
|
Regression from #726
|
|
Add glob function
|
|
|
|
Addition of new length function
|
|
|
|
(MODULES-4473) join strings for i18n parser
|
|
* (#FM-6068) allow file encoding to be specified
Add a new parameter `encoding` to allow non UTF-8 files to specify a file encoding. This prevents receiving the error message "invalid byte sequence in UTF-8" when special characters that are not UTF-8 encoded appear in the input stream, such as the copyright symbol.
* (#FM-6068) allow file encoding to be specified
Added docs and tests as requested
|
|
|
|
This commit joins all strings that are split over two lines with a plus,
backslash, or double less than so that our magical i18n parser can wave
over the module and mark every ruby string with our i18n function.
|
|
|
|
Add pry() function from hunner-pry
|
|
(MODULES-4188) Add UUID generation function
|
|
HAIL9000/issue/master/MODULES-3829_add_tests_for_ensure_resources
(MODULES-3829) Add tests for ensure_resources
|
|
Prior to this commit, if a hash was passed in as an
argument to the ensure_packages function a method of
hash duplication would be used that is not supported
with versions of ruby older than 2.0. In order to
ensure the method is compatible with older ruby versions,
switch to a different method of duplication.
Additionally add tests to prevent further regressions.
|
|
* Generates UUID based on a given FQDN string and the DNS namespace (6ba7b810-9dad-11d1-80b4-00c04fd430c8)
|
|
|
|
Prior to this commit, users coming to the type_of function would not realize that the type function in puppet does the same thing and is preferred over type_of.
After this commit, we have a comment indicating the above.
|
|
(MODULES-3393) Deprecation - Use puppet stacktrace if available
|
|
Without this, some uses of this function do not work in puppet3. e.g.
if $include_src != undef {
deprecation('apt $include_src', "please use \$include => { 'src' => ${include_src} } instead")
}
causes
Function 'deprecation' must be the value of a statement
on puppet 3.8.7.
|
|
A previous PR (#685) was raised on this issue, however once it was merged it was discovered that Puppet 3 with future parser enabled was calling the Puppet 4 version of the deprecation function. The Puppet stacktrace is not available until Puppet 4.6, so this was breaking existing setups. The solution was to check is the stacktrace was defined, and if it was to use it as part of the message output.
|
|
|
|
|
|
Handle array values in join_keys_to_values function
|
|
This function otherwise fails during `puppet preview` on Puppet 3.8.X systems.
|
|
|
|
This is a workaround for PUP-4438 (fixed in https://github.com/puppetlabs/puppet/commit/e01c4dc924cd963ff6630008a5200fc6a2023b08, 4.1.0, 3.8.1).
It works by manually passing through the scope, instead of relying on the
InternalFunction class.
|
|
This now emits one deprecation warning for each function used (but not for each call-site). Prior to this, only a single deprecation warning would have been triggered, potentially misleading users.
Additionally this adds v4 deprecation stubs for the functions that were missed.
|
|
|
|
This reverts commit b63862ff43194194f7428739a32cfe13bad1e7ed, as it would
only show the irrelevant first entry of the ruby stack trace. The
puppetserver log does contain the full trace information, or you can use
--strict=error to cause a hard failure when hitting a deprecation.
# Conflicts:
# lib/puppet/functions/validate_legacy.rb
|
|
`catch` returns value of second argument to `throw`, which until 860a2761f334c964068038b3ef6853f08beb1df5 was `nil`, but now is non-falsey reason for error. short-circuit using return and eval to nil if `throw` was caught.
|
|
|
|
This was not working when the puppet master did not have the newest stdlib
version in its environment.
|
|
Prior to this commit, due to a bug in the exists? method in the
file_line provider, match_for_absence didn't work as described (or
at all really). Update the exists? logic so that match_for_absence
works as described.
Additionally add a unit test to prevent regressions and update the
documentation for the parameter to reflect the fact that it is
ignored when `ensure => present`.
|
|
This is the idiomatic version of #634, and also addresses
the test failures.
Original-Fix-By: Michiel Brandenburg <michiel@silverstreet.com>
|
|
When validate_string is called via the Puppet 4 deprecation wrappers
from deprecation_gen (introduced in 970852d), `undef` is passed as `nil`
where it was previously passed as `''` from the Puppet 3-style function
API.
This change explicitly permits a `nil` value in validate_string, and
adds a test case to `is_string` which also accepts the same.
Fixes test failures in apt, concat etc:
Error while evaluating a Function Call, nil is not a string. It looks to be a NilClass at apt/manifests/source.pp:23:3 [..]
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:34:in `block (2 levels) in <module:Functions>'
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `each'
# ./spec/fixtures/modules/stdlib/lib/puppet/parser/functions/validate_string.rb:32:in `block in <module:Functions>'
# puppet-4.7.0/lib/puppet/parser/functions.rb:174:in `block (2 levels) in newfunction'
# puppet-4.7.0/lib/puppet/util/profiler/around_profiler.rb:58:in `profile'
# puppet-4.7.0/lib/puppet/util/profiler.rb:51:in `profile'
# puppet-4.7.0/lib/puppet/parser/functions.rb:167:in `block in newfunction'
# ./spec/fixtures/modules/stdlib/lib/puppet_x/puppetlabs/stdlib/deprecation_gen.rb:13:in `block (2 levels) in deprecation_gen'
|
|
|
|
|
|
Add deprecation warnings to remaining validates
|
|
|
|
|
|
Ensure validate functions use Puppet 4 deprecation
|
|
|
|
|
|
Refactor dig44 function
|
|
* validate_legacy now accepts undef values
* update the TypeMismatch message to include the original validate function name
* only notice, not warn, on newly allowed values
* changed previous_validation to function_name to avoid confusion with the function of the same name
* use deprecation() instead of warn(), when hitting a deprecated value
* prepare the tests and function for MODULES-3735
* rewrite validate_legacy tests to use new rspec-puppet
* move validate_re deprecation to puppet4 only
* adapt validate_re_spec
|
|
|
|
|
|
The current implementation of the dig44 function has the
following problems:
* Doesn't recognise Puppet4's :undef value as an empty value
and doesn't return the default value.
* Doesn't make a different between false and nil value
and returns the default value for a non-empty false value
|