Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
If a class is contained twice in the same location, this is consistent but
should only create one edge.
|
|
This also includes some minor refactoring of the contain function.
|
|
|
|
This adds the 'contain' function. When used inside of a class definition, it
will create a containment relationship such that the current class contains
the argument of 'contain'.
|
|
|
|
zaphod42/issue/master/21409-create_resources-differs-from-real-resource
(#21409) Ensure that create_resources acts the same as a resource decl
|
|
This ties the selection of the Puppet::Graph::Prioritizer to the
Puppet[:ordering] setting. In order to make it easier to ensure that all
of the uses of the prioritizer use the same one (because it needs to
track state) this also moves around the relationship of the catalog and
the transaction. Previously the catalog was responsible for converting
itself into a relationship graph. This now puts that responsibility on
the transaction, which much now be constructed with the desired
Prioritizer. The selection is still done in the catalog (because that is
where #apply lives, which is the public starting point of applying a
catalog).
Additionally this adds a random prioritizer.
|
|
The lookup function test was missing because the setting --binder
was missing, and lookup only works when this feature is turned on).
|
|
|
|
This adds the ability to call lookup with a lambda that gets the looked
up result for futher processing. The lambda gets undef when nothing was
found. This enables a convenient way to define a default when value is
missing.
|
|
The lookup() function can now enforce the type that the caller of the
function is expecting to receive by being provided a type specification
as a second argument. If no argument is provided it will default to
needing "Data", which is the supertype of all of the data types (Object
is a supertype, but doesn't not result in getting a looked up value
because the type is also part of a namespace for the injection system
and it holds object separate from data).
|
|
The lookup() function will use the configured bindings and injector to
lookup a value. If one is not found, then nil is returned (which is
undef in the puppet language). Any errors from the injector are
propogated out to the caller.
|
|
The previous implementation of create_resources duplicated most of the
logic of Puppet::Parser::AST::Resource, but had variations which meant
that it didn't actually behave the same. This lead to the possibility
that what should have been equivalent statements in the language did not
always result in the same catalog. This re-implements create_resources
to construct the AST that is needed to create the requested resources
and evaluate the resulting structure. This should only be able to
differ from actual resource declarations in the language if the
constructed AST is wrong.
|
|
* stable:
(#21043) Use ruby.exe instead of rubyw.exe
(#21264) Update rgen dependency to 0.6.5
(Maint) Cleanup specs
(#21320) Use sleep in the daemon loop instead of select
|
|
This cleans up the specs to make them a little more expressive of the
behavior of the fqdn_rand function's real functionality. One surprising
result that came out of this was that the tests tried to assert that the
fqdn_rand function was callable without any arguments. However the test
for this passed simply because it asserted that a particular error was
*not* raised, when in fact a different exception that expressed what it
was trying to catch (ArgumentError vs. Puppet::ParserError). The docs
indicate that calling with no arguments is not actually supported and so
that test has been removed.
|
|
commit 9ed6fcea48591cda58db1379b58cd39dfbdca684 which added arity checks
|
|
Before this change hiera includes which looked up an empty array
resulted in this error:
ArgumentError: include(): Wrong number of arguments given (0 for minimum 1)
Now hiera includes properly allow for a lookup that results in an empty
array
This regression was caused by the arity checks committed in
9ed6fcea48591cda58db1379b58cd39dfbdca684
|
|
|
|
Previously, the sprintf spec failed, because ruby outputted the
exponent with a leading zero, despite a precision of 2. The zaml spec
failed, because ruby didn't recognize the Europe/London timezone.
Ruby 1.9 fixes these issues, so the workaround in sprintf_spec is no
longer necessary, and the zaml_spec issue is no longer pending.
|
|
|
|
The test for the hiera_* functions showed an interesting error. If the
hiera_hash or hiera_array tests were run in isolation they would
complain that Hiera was not defined and then fail. If the hiera_include
tests were run beforehand, then the tests for hash and array worked as
expected. The issues seems to have been that the require that brought in
hiera was being delayed until too late. By making sure that hiera-puppet
is loaded as soon as the function is defined, rather than called, we are
certain that hiera will be around when we need it.
|
|
We should not fiddle with the global seed, as other people
might still depend on Kernel.rand() not being that deterministic
as it is the idea with the fqdn_rand function.
However, as ruby < 1.9.2 does not provide such a nice solution, as
a dedicated Random class we simply call Kernel.srand() again on ruby
< 1.9.2 -> Reinitialize with a less deterministic seed.
|
|
The attribute accessor for the :string attribute in the TemplateWrapper
conflicted with a variable being in scope that is named string. The
variable would take precedence and because of the way the
TemplateWrapper accessed the value of the attribute, the variable's
value would be used as the template.
This changes the TemplateWrapper to completely remove :string as an
attribute and only use local variables. This also removes the :file
attribute in favor of a "private"-style naming of the instance variable.
There are no collisions with @__file__ that would cause problems, but
this should reduce the likelihood of them happening in the first place.
|
|
Some of the previous tests were unneeded (check for simple existance) or
mis-named. This cleans those up. A few other tests were trying to
indirectly test many things at once (the ones about access to instance
variables). Instead of the indirect test this splits it into much more
specific tests and statement of behavior.
|
|
Tests for extlookup() key lookups were passing a block into Tempfile.new,
which it doesn't run. The initialization of the CSV file was performed and
then extlookup() was called inside the block. Since it isn't run, the tests
aren't executed.
This moves the tests out of the block and changes how the CSV file is created,
since the extlookup() function doesn't take an absolute path to a CSV file.
Instead a temporary directory is now created and the CSV file created inside.
An incorrect test that should have checked for a raised error has also been
fixed.
|
|
* dalen-function_arity:
(#15989) Tests for function arity
(#15989) Set arity on functions
(#15989) Allow setting arity on functions
|
|
* 3.0.x:
(maint) Fix hiera_include spec tests
Maint: Clarify that the managehome parameter will delete a home directory
|
|
Without this patch applied, the hiera_include function spec tests are
not examples of actual behavior. In the spec tests the stubbed methods
would return an empty array, which would then be forwarded straight away
to the include parser function. The example did not have the
expectation that this would raise an error.
This behavior is a problem because adding arity checking to the
functions becomes more difficult if theses examples are not
demonstrating exepcted behavior. Instead, the change to check arity
causes these examples to fail unexpectedly.
This patch fixes the problem by setting the expectations of the actual
behavior of the hiera_include functions more accurately. An empty array
is no longer returned from the stubbed Hiera behaviors. This patch
causes us to expect the system to take exception with trying to include
a non-existent class.
|
|
Without this patch the create_resources function is unable to create
virtual or exported resources. This is a problem because the resources
created by create_resources are not a first class citizen with respect
to resources created from the Puppet DSL, or other means.
This patch fixes the problem by allowing the create resources function
to accept type names prefixed with @ or @@.
For example, the following puppet manifest works with this patch
applied.
create_resources('@file', {'/etc/foo' => {'ensure'=>'present'}})
realize(File['/etc/foo']
|
|
Set the arity on builtin functions.
|
|
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,'
|
|
zaphod42/ticket/3.x/15756-disallow-incorrect-function-calls
(#15756) Do not allow functions called without Array
|
|
daniel-pittman/maint/3.x/ast-scope-only-uses-string-names
AST Scope variable names must be strings.
|
|
These tests relied on being able to call functions in the incorrect
fashion of not passing an array as the argument. They now call the
function under test correctly.
|
|
This updates the tests to work correctly in the Puppet environment, rather
than running as part of a separate repository and package.
It also moves the examples into a more appropriate location.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
The Parser AST scope had an embedded assumption that variable names were
always strings, but didn't actually enforce that. A consequence of this is
that a couple of tests violated that agreement.
This adds an internal error report when someone tries the wrong thing, and
cleans up the handful of tests that failed.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
Conflicts:
lib/puppet/parser/functions/shellquote.rb
lib/puppet/type/package.rb
spec/integration/util/file_locking_spec.rb
spec/unit/parser/functions/shellquote_spec.rb
spec/unit/util/command_line_spec.rb
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
This moves two constants into local variables inside the function, as the
constants polluted the Puppet::Parser::Functions namespace and caused warnings
when the function was reloaded.
|
|
Set the logging parser functions (notice, err, etc) on the root environment.
This also requires setting the current environment to be nil in
Environment.clear by setting it directly on Thread.current. Otherwise the
default environment from puppet.conf is used. In tests this was interfering
with the log functions being set on the root environment instead of the
current environment.
|
|
* 2.7.x:
Add Puppet::Parser::Functions::clear for specs
Clear Environment.current when calling Environment.clear
Check that function loading worked correctly.
Avoid stubbing Thread::new due to issues in newer mocha
Rename specs to end in _spec.rb
Don't require mocha in spec_helper
Fix stubbing on nil in some specs
(#14515) Tests fail with mocha 0.11.4
Conflicts:
spec/unit/network/http/webrick_spec.rb
spec/unit/parser/functions/require_spec.rb
spec/unit/parser/functions/template_spec.rb
|
|
Since functions uses class instance variables to track which functions are
loaded, we need to clear this between tests.
|
|
Prior to this commit, these tests only worked with mocha 0.10.5 because
the tests were broken and trying to stub methods on nil, which mocha
0.11.4 no longer allows. After this commit, these tests work with both
mocha 0.10.5 and 0.11.4.
|
|
In rspec 2.11, expectations on a block must take the form of expect...to or
lambda...should. Other combinations of those are no longer accepted. This
commit converts all mixed cases to use expect...to, as it seems to be the
preferred syntax now.
|
|
|
|
|
|
* 2.7.x:
Use rspec 2.11 compatible block syntax
Conflicts:
spec/integration/faces/ca_spec.rb
spec/integration/network/server/mongrel_spec.rb
spec/unit/application_spec.rb
spec/unit/face/help_spec.rb
spec/unit/network/handler/fileserver_spec.rb
spec/unit/parser/functions/create_resources_spec.rb
spec/unit/provider/nameservice/directoryservice_spec.rb
spec/unit/type/file_spec.rb
spec/unit/type_spec.rb
|
|
In rspec 2.11, expectations on a block must take the form of expect...to or
lambda...should. Other combinations of those are no longer accepted. This
commit converts all mixed cases to use expect...to, as it seems to be the
preferred syntax now.
|
|
The parser resource object had a bunch of support for handling metaparameters
differently for clients less than 0.25 - which is long, long dead, and can
just be eliminated from the tree.
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|
|
Now that the compiler is always required by the scope we can save a few
keystrokes by making the non-optional argument a regular value, not a name
prefixed option.
(...even if I love Objective-C as much as the next developer, having the same
text in every call just to name the argument doesn't make much sense in such
an internal context.)
Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
|