Age | Commit message (Collapse) | Author | Files | Lines |
|
* pr/2819:
(maint) Remove biff setting and related code
(PUP-2858) Remove evaluator setting
(PUP-2858) Remove duplicated testing (evaluator = 'current')
(PUP-2858) Refactor binder to use ne evaluator
(PUP-2858) Remove the 3_1 checker and its factory
(PUP-2858) Refactor EvaluatingParser::Transitional to EvaluatingParser
(PUP-2858) Remove use of Puppet[:evaluator] from the code base
(PUP-2858) Deprecate the use of Puppet[:environment] == current
(PUP-2858) Remove e_parser adapter support
Conflicts:
spec/integration/node/environment_spec.rb
Closes #2819
|
|
This makes the ability to load all .pp files under a manifest dir
recursively conditional to parser == future. (It will become the
standard in Puppet 4.0). This is done to avoid slurping in lots of files
in case users kept other files around in a subdirectory in the belief
that they would not be loaded. Thus making it harder to upgrade.
This also adds a test that runs for future parser.
|
|
There was a test (environment_spec) that ran an extra time
with the hybrid parser = future, evaluator = current which results
in the same tests running twice. (This because the future evaluator
is enforced when runing with future parser).
|
|
Using the have_resource matcher makes the tests a little shorter and
more expressive. It also uses the common way of matching so that we can
get better error reporting.
It turns out that one of the tests was matching against the incorrect
class name, so that is now fixed.
This also extracts a be_resource matcher so that you can match against
an individual resource independent of a catalog.
|
|
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
|
|
|
|
The future evaluator is only really in play when both the parser is
future and the evaluator is future. The old check left out the evaluator
portion of that check and so ended up using the wrong CodeMerger when
using the current evaluator with the future parser.
|
|
Previously BlockExpression would skip evaluating any AST nodes that
implement an instantiate method. The assumption was that instiate only
existed on Hostclass, Node, and Definition AST nodes and those same
classes also did not implement an evaluate method. With the introduction
of the PopsBridge::Program class, this entire house of assumption cards
came falling down, since it impelements both instantiate and evaluate.
The only thing that truly prevented BlockExpression from calling
evaluate was that the default evaluate implementation on Parser::AST
raised a Puppet::DevError to try to catch the case of evaluate not
being implemented for an AST class. Since Parser::AST is entirely
internal and missing an evaluate should show up very quickly in tests,
we can just as easily make evaluate a noop by default, which then
simplifies BlockExpression.
This change fixes the problem where the body of pp files were loaded,
but not evaluated when using the future evaluator and a directory of
manifest files. The problem was triggered by the BlockExpression logic
interacting with the PopsBridge::Program object and the structure
created by the Puppet::Pops::Parser::CodeMerger.
|
|
Instead of creating environments directly, we need to go through the
configured environment loaders, otherwise environments can't come from
other places.
|
|
This changes the API in a new implementation in a file called file_.rb
The intent is that it should replace the implemntation in File,
or perhaps directly in a Puppet::FileSystem class.
|
|
|
|
This adds the ability to run a directory of manifests instead
of just a single file. Simply assign a directory to Puppet[:manifest]
via settings or from the command line.
The files are parsed and combined in alphabetical order as if the
files were to be concatenated into a single file.
The support is in environment, and it is only support for the
initial import. This also means that both current and future parser
can be used (i.e. the support for this is not in the parser).
Testing is done in integration/node/environment_spec.
|
|
- 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
|
|
Without this patch Ruby 1.9 is still complaining loudly about trying to
parse the spec files. The previous attempt to clean up this problem in
edc3ddf works for Ruby 1.8 but not 1.9.
I'd prefer to remove the shebang lines entirely, but doing so will cause
encoding errors in Ruby 1.9. This patch strives for a happy middle
ground of convincing Ruby it is actually working with Ruby while not
confusing it to think it should exec() to rspec.
This patch is the result of the following command run against the source
tree:
find spec -type f -print0 | \
xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
|
|
Without this patch some spec files are using `ruby -S rspec` and others
are using `rspec`.
We should standardize on a single form of the interpreter used for spec
files.
`ruby -S rspec` is the best choice because it correctly informs editors
such as Vim with Syntastic that the file is a Ruby file rather than an
Rspec file.
|
|
Puppet::Indirector::Request#initialize had a weird implementation giving
variable semantics to positional arguments. This makes it normal again.
|
|
We have removed every usage of cached_attr in which the attribute needs to be
manually expired. Thus, the only meaningful behavior provided by
Puppet::Util::Cacher is expiration based on TTLs. This commit reworks the
cacher to only support that behavior.
Rather than accepting an options hash, of which :ttl is the only available
option, cached_attr now requires a second argument, which is the TTL.
TTLs are now used to compute expirations, which are stored and used for
expiring values. Previously, we stored a timestamp and used it and the TTL to
determine whether the attribute was expired. This had the potentially
undesirable side effect that the lifetime of a cached attribute could be
extended after its insertion by modifying the TTL setting for the cache. Now,
the lifetime of an attribute is determined when it is set, and is thereafter
immutable, aside from deliberately re-setting the expiration for that
particular attribute.
Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
(cherry picked from commit d198fedf65e472b384666fc9ae3bef487852068a)
Conflicts:
spec/integration/node/facts_spec.rb
spec/unit/node_spec.rb
|
|
For a while Luke, and other authors, injected a created tag, copyright
statement, and "All rights reserved" into every new file they added to the
Puppet project.
This isn't really true, and we have a global license covering the code, so
we have now stripped out all those old tags.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
This includes various style changes, and assorted fixes to testing.
Paired-With: Matt Robinson
|
|
We now use a shebang of: #!/usr/bin/env rspec
This enables the direct execution of spec tests again, which was lost earlier
during the transition to more directly using the rspec2 runtime environment.
|
|
rspec2 automatically sets a bunch of load-path stuff we were by hand, so we
can just stop. As a side-effect we can now avoid a whole pile of stupid things
to try and include the spec_helper.rb file...
...and then we can stop protecting spec_helper from evaluating twice, since we
now require it with a consistent name. Yay.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
|
|
Doing a require to a relative path can cause files to be required more
than once when they're required from different relative paths. If you
expand the path fully, this won't happen. Ruby 1.9 also requires that
you use expand_path when doing these requires.
Paired-with: Jesse Wolfe
|
|
This change replaces calls to <model object>.save with calls to <model
class>.indirection.save(<model object>). This makes the use of the
indirector explicit rather than implicit so that it will be easier to
search for all indirector call sites using grep. This is an
intermediate refactor on the way towards allowing indirector calls to
be explicitly routed to multiple termini.
This patch affects tests only; the next patch will make the
corresponding change to the code.
|
|
Replaced uses of the find, search, destroy, and expire methods on
model classes with direct calls to the indirection objects. This
change affects tests only.
|
|
Replaced 106806 occurances of ^( +)(.*$) with
The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people
who learned ruby in the 1900s) uses two-space indentation.
3 Examples:
The code:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
becomes:
end
# Tell getopt which arguments are valid
def test_get_getopt_args
element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new
assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args")
The code:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
becomes:
assert_equal(str, val)
assert_instance_of(Float, result)
end
# Now test it with a passed object
The code:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
becomes:
end
assert_nothing_raised do
klass[:Yay] = "boo"
klass["Cool"] = :yayness
end
|
|
Some spec files like active_record.rb had names that would confuse the
load path and get loaded instead of the intended implentation when the
spec was run from the same directory as the file.
Author: Matt Robinson <matt@puppetlabs.com>
Date: Fri Jun 11 15:29:33 2010 -0700
|
|
We had to fix the fileserving plumbing to use the request
environment instead of trying to use the node environment.
This was apparently never fixed after we added the environment
to the URI in REST calls.
There's still a bit of refactoring left to clean up the APIs used
in some of this code.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
Conflicts:
test/ral/type/filesources.rb
|
|
The problem was that the mechanism I was using for
passing the node to the compiler was conflicting with
the Indirector::Request's method of handling node
authentication.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
Conflicts:
CHANGELOG
|
|
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
Conflicts:
CHANGELOG
spec/integration/defaults.rb
spec/integration/node/catalog.rb
spec/unit/rails.rb
spec/unit/type/mount.rb
|
|
|
|
This provides a single, global bit for determining whether
a given piece of cached data is still valid.
|
|
internally), and fixing the Facts class so it
auto-expires any associated cached nodes when facts
are saved.
|
|
class instead of the Indirector module. Also, added
an 'expire' method to the indirector, so there's an easy way
to expire cached instances.
|
|
expecting requests instead of having a random interface.
|
|
This commit adds a Request instance into the indirection,
pushing it all the way to the terminus instances. It's
a big commit because it requires modifying every terminus class.
There are still some thorny design issues. In particular, who
should be responsible for making the request object? I've tried
having both the indirection class and the Indirector module creating
it, and both have their issues.
Also, the Catalog class previously allowed passing Node instances
directly to the find method, which is now no longer possible because
the Request class would treat the node as the instance being found.
We need the request class to have two modes, one when it's passed an
instance and one when it's passed a key.
|