| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Ruby's default #inspect method can lead to printing factorial-order
output for large graphs of objects. Since we have large graphs of
objects, this is not optimal.
This patch replaces a few well-connected objects' #inspect methods with
methods that produce reduced output, and are thus much faster.
Paired-With: Nick Lewis <nick@puppetlabs.com>
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
From the spec directory I found all the specs that fail when run on their own.
for TEST in `find . -name "*.rb" -type f`; do
spec $TEST > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo $TEST
fi
done
All of them were cases of missing requires.
Paired-with: Nick Lewis <nick@puppetlabs.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
From the spec directory I found all the specs that fail when run on their own.
for TEST in `find . -name "*.rb" -type f`; do
spec $TEST > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo $TEST
fi
done
All of them were cases of missing requires.
Paired-with: Nick Lewis <nick@puppetlabs.com>
|
|\| |
| |/
|/|
| |
| |
| | |
Resolved conflicts manually:
spec/integration/indirector/bucket_file/rest_spec.rb
spec/integration/indirector/certificate_revocation_list/rest_spec.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When the responsibility for type-name resolution was moved to the AST nodes in
commit 449315a2c705df2396852462a1d1e14774b9f117, at least one instance was
missed: the space ship operator
Myclass <<| tag == foo |>>
fails unless Myclass has been previously loaded. This commit adds the lookup
to AST::Collection nodes in the same way it was added to the other node types.
Note that I haven't audited the other note types for similar cases.
|
| |
| |
| |
| | |
My code smell routines bobbled this one, so I'm fixing it manually.
|
| |
| |
| |
| |
| |
| |
| | |
The autoloading is not thread safe, which means two threads could both
autoload the same function at the same time.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It is a resurgence of #2366 that appeared because of the commit
8971d8.
Before this commit, for associating documentation comments, we
were preferring line numbers coming from the parser currently reducing rule,
instead of the current lexer line number (which can be in advance
of several tokens due to the nature of LALR parsers).
We now merge the ast line number before fetching the comment from the
lexer.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Accesing an array with an integer index (ie $array[1]) is producing
a ruby error: can't convert String into Integer
This is because the array index is not properly converted to an number
before the array element lookup is performed.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|\|
| |
| |
| |
| |
| | |
Manually resolved conflicts:
lib/puppet/parser/ast/resource.rb
spec/unit/parser/ast/resource_spec.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a reconciliation/melding of Paul's
(#4534) Class inheritance with parameterized classes is no longer ignored
and Markus's
Fix for #4778 -- evaluate parameterized classes when they are instantiated
Extracted the code from Resource::Type#mk_plain_resource that evaluates
parents and tags the catalog, and moved that into a new method called
instantiate_resource. Instantiate_resource is now also called from
Parser::Ast::Resource#evaluate, so that the notation
"class { classname: }"
now executes this code too. Likewise adds class evaluation so that it behaves
the same (with regard to lazy / strict evaluation) as
include classname
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This was a regression, not covered by a test; previously the string
"foo\
bar"
would be interpreded as "foobar" but this was changed to "foo\\\nbar" in
2.6.x with my string interpolation refactor. This change restores the
behaviour.
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This patch conflicts with a backport of itself. This merge resolution
favors the original patch for the code changes, and the 2.6.2 patch for
the specs.
Manually Resolved Conflicts:
lib/puppet/dsl/resource_type_api.rb
lib/puppet/parser/ast/definition.rb
lib/puppet/parser/parser_support.rb
spec/integration/parser/ruby_manifest_spec.rb
spec/unit/dsl/resource_type_api_spec.rb
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
environments or staleness check
Changed the resource type API to create AST objects rather than
directly instantiating resource types. This allows the same code
paths to be used to handle the results of parsing both .pp and .rb
files. This makes .rb files work properly in multiple environments,
because the types are now instantiated by code that is aware of which
environment the compilation is happening in. It also reduces the risk
of future changes breaking .rb file support.
Also, switched to using "instance_eval" rather than "require" to
evaluate the contents of the .rb file. This ensures that if the file
has to be recompiled (because it became stale), it will actually get
re-evaluated. As a side benefit, ResourceTypeAPI is now a class
rather than a mixin to Object, so its methods do not pollute the
global namespace.
To reduce the risk of customers coming to rely on implementation
details of the resource type API, changed its methods to return nil,
and removed methods from it that were misleadingly labeled as
"private".
|
|\ \ \
| | |/
| |/| |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The evaluate_definitions method was first figuring out which resources
needed to be evaluated (using unevaluated_resources), and then
evaluating them one by one. As a result, if evaluating one resource
triggered another resource to be evaluated, the latter resource could
get evaluated twice. This bug could occur, for example, if both
resources were classes that were included into the node by an external
node classifier, and if the first of the two classes included the
second.
Modified Resource#evaluate to be idempotent.
Also added an integration test to verify the fix.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Part of the ongoing refinement / cleanup of the string interpolation semantics.
When scanning for an unescaped string terminator we now also allow an 0 or more
pairs of backslashes (that is, escaped backslashes) before the terminator.
Thanks to Jacob for the test I should have added.
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The API for AST objects has changed, making the initialization of this
spec somewhat more complicated.
Also, git seems to have been confused by whitespace changes.
Manually Resolved Conflicts:
lib/puppet/parser/ast/resource.rb
|
| | |
| | |
| | |
| | |
| | | |
This is another case where our test objects were overly mocked so they
didn't alert us to problems with our implementation.
|
|\| |
| | |
| | |
| | | |
There are merge conflicts with commits following this one.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The :undef symbol, which we use internally to distinguish between
undefined variables and variables whose value is the empty string, is
being leaked in calls to functions (e.g. "split"). This is a
departure from 0.25.x behavior, where undefined variables evaluated to
"".
This patch restores the 0.25.x behavior.
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Some specs were in conflict, as they had been recently modified to use
the API functionality that f950061 removes. This merge commit simply
restores the verson of those specs from f950061.
Manually Resolved Conflicts:
spec/unit/dsl/resource_type_api_spec.rb
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Made the following modifications to ResourceTypeAPI:
(1) returned nil from “define”, “hostclass”, and “node”.
(2) renamed “mk_resource_type” and “munge_type_arguments” to
“__mk_resource_type__” and “__munge_type_arguments__” to discourage
customers from calling them.
(3) Made ResourceTypeAPI a class rather than a module, and changed the
parser to evaluate the contents of pure ruby manifests using a
instances of this class.
(4) Changed ResourceTypeAPI to insert newly instantiated types into
Thread.current[:known_resource_types] rather than the default
environment's known_resource_types.
This effectively backports the fix for issue #4657 to 2.6.x.
Also backported the new spec tests from #4657.
|
|\| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Commit 2b50f30 simplified and fixed bugs in code that had already been
modified extensively by 4da88fb and 6b1dd81. This merge resolution
commit is a manual replay of the changes from 2b50f30 onto next.
Manually Resolved Conflicts:
lib/puppet/parser/type_loader.rb
spec/unit/parser/type_loader_spec.rb
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The function import_if_possible, which was supposed to be responsible
for making sure that no two threads tried to import the same file at
the same time, was not making this decision based on the full pathname
of the file, since it was being invoked before pathnames were
resolved. As a result, if we attempted to import two distinct files
with the same name at the same time (either in two threads or in a
single thread due to recursion), one of the files would not always get
imported.
Fixed this problem by moving the thread-safety logic to happen after
filenames are resolved to absolute paths. This made it possible to
simplify the thread-safety logic significantly.
|
|\| |
| | |
| | |
| | | |
There are merge conflicts with commits following this one.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is a minimal fix for #4631 by reversing one part of the refactor for #1903
commit 0d4fd60c7c143cc1f4e4b0f99f359c09cbfbf21e. It fixes the immediate issue
(implicit classes not being added to resources) but leaves open several other
questions which are defered to #4687.
|
| | | |
|
| | | |
|
|\| | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
My fix for #4542 was overly enthusiastic about assuring that all resources had
a stage, resulting in stages designations being serialized for resources in
manifests which did not use resources (everything was in implicit main). This
broke 0.25.x compatibility, as all catalogs now refered to stages.
This patch scales back the change for #4542 slightly, supressing the setting of
main on the puppetmaster and relying on the default behaviour on the client (for
2.6.x and later, treat it as main; for 0.25.x, do nothing).
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Conflicts resolved manually, by Paul Berry:
lib/puppet/parser/ast/astarray.rb
lib/puppet/parser/grammar.ra
lib/puppet/parser/parser.rb (by rebuilding from grammar.ra)
|
| | |/
| |/|
| | |
| | |
| | | |
or node occurs in a conditional construct so that it contains the
proper line number.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously, ASTArray#evaluate() was responsible for checking whether
the user had tried to declare a class, define, or node in a prohibited
location (such as a conditional construct). This meant that errors
would only be reported to the user if the conditional code was
actually evaluated.
Moved the checking into the parser, so that errors are always
reported.
|
|\ \ \
| |/ /
|/| | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Changed the grammar so that the following "plural" constructs always
parse as an ASTArray:
- funcvalues
- rvalues
- resourceinstances
- anyparams
- params
- caseopts
- casevalues
And the following "singluar" construct never parses as an ASTArray:
- statement
The previous behavior was for these constructs to parse as a scalar
when they represented a single item and an ASTArray when they
contained zero or multiple items. ("Statement" could sometimes
represent a single item because a single resource declaration could
represent multiple resources). This complicated other grammar rules
and caused ambiguous handling of nested arrays.
Also made these changes to the AST class hierarchy:
- ResourceInstance no longer derives from ASTArray. This relationship
was not meaningful because a ResourceInstance is a (title,
parameters) pair, not an array, and it produced complications when
we wanted to represent an array of ResourceInstance objects.
- Resource no longer derives from ResourceReference. No significant
functionality was being inherited and the relationship doesn't make
sense in an AST context.
- ResourceOverride no longer derives from Resource. No significant
functionality was being inherited and the relationship doesn't make
sense in an AST context.
- Resource can now represent a compound resource instance such as
"notify { foo: ; bar: }". This saves the parser from having to
use represent a statement as an array of objects.
- ASTArray's evaluate method never flattens out arrays of arrays.
|
|\ \ \
| |/ /
|/| /
| |/ |
|
| |
| |
| |
| |
| |
| | |
This commit unifies the code paths on which classes are added, alters the default
stage to respect the stage of the parent if any, and assures that the resource is
notified if its stage is assigned (turning an implicit stage into an explicit one).
|
|\ \
| |/
|/|
| | |
a.k.a. "make_taller_trees"
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
definitions (classes, definitions, and nodes).
Previously, type definitions were not represented directly in the AST.
Instead, the parser would instantiate types and insert them into
known_resource_types as soon as they were parsed. This made it
difficult to distinguish which types had come from the file that was
just parsed and which types had been loaded previously, which led to
bug 4496.
A side-effect of this change is that the user is no longer allowed to
define types inside of conditional constructs (such as if/else). This
was allowed before but had unexpected semantics (bugs 4521 and 4522).
It is still possible, however, to place an "include" statement inside
a conditional construct, and have that "include" statement trigger the
autoloading of a file that instantiates types.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Moved type-name resolution out of Puppet::Parser::TypeLoader, and into
its primary client, Puppet::Resource::TypeCollection. TypeCollection
now always passes fully qualified type names to TypeLoader.
This avoids duplicate type-name resolution logic between TypeLoader
and TypeCollection. That in turn fixes bug 4472, which resulted
from flaws in the type-name resolution logic in TypeLoader.
In addition, it fixes bug 4483, which resulted from improper
interleaving between looking up names using the TypeCollection and the
TypeLoader.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
AST resources.
Move type-name resolution out of Puppet::Resource into the AST resources.
Move find_resource_type out of Puppet::Resource into Scope
Thus, never pass unqualified type names to Puppet::Resource objects.
Thus, Puppet::Resource objects don't need the namespace property,
and Puppet::Resource objects never consult the harddrive to look for
.pp files that might contain their type definitions,
Thus, performance is improved.
Also removes the temporary fix for #4257 that caused #4397
(The code was too eager to look for a class in the topscope)
Paired-With: Paul Berry <paul@puppetlabs.com>
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is the rest of the change for #4303; James and I discussed various
ways the solution to that ticket needed to be extended but, as neither of us
committed code, nothing changed. This is the least implact extension, which
mimics the behaviour of prior versions.
It leaves open the question: should '\\x' start with a single or double
backslash? If, as now, '\\x' starts with a double backslash (i.e. single quote
is the only escapable characterin single quoted strings) a string ending in a
backslash can not be represented in a single quoted string.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Stage[main] is created without an associated source, to which
Parser::Resource::Param objects. This patch observes that the source
attribute of both Parser::Resource and Parser::Resource::Param seem
not to be used anywhere, and removes the requirement that it be
supplied.
|
| |
| |
| |
| | |
http://serverfault.com/questions/166199/puppet-md5-sum-of-string
|
| |
| |
| |
| |
| |
| |
| | |
extlookup was adding its data files to the list of watched source files.
This causes the .pp manifests to be re-parsed whenever the .csv files
change, which is no longer necessary, as the .csv files are already
reparsed on every function call.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We found the gsub! in extlookup was actually modifying the value for
extlookup_precedence, so the next node to call it just got the
interpolated value from the first run.
We did two things in the code to prevent this:
1. We returned a dup of the ast string object so that modifying it
wouldn’t change puppet’s state. We didn’t do this for all possible
return values because we depend on using the original ast array object
to do array concatenation
2. We fixed extlookup to not do a destructive gsub
Reviewed by: Jesse Wolfe
|