| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
This patch allow this syntax:
$hash[mykey] = 12
If the key already exist an error is raised. Hashes are essentially
write only, like puppet variables.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
| |
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bring a new container syntax to the Puppet DSL: hashes.
Hashes are defined like Ruby Hash:
{ key1 => val1, ... }
Hash keys are strings, but hash values can be any possible right
values admitted in Puppet DSL (ie function call, variables access...)
Currently it is possible:
1) to assign hashes to variable
$myhash = { key1 => "myval", key2 => $b }
2) to access hash members (recursively) from a variable containing
a hash (works for array too):
$myhash = { key => { subkey => "b" }}
notice($myhash[key][subjey]]
3) to use hash member access as resource title
4) to use hash in default definition parameter or resource parameter if
the type supports it (known for the moment).
It is not possible to string interpolate an hash access. If it proves
to be an issue it can be added or work-arounded with a string concatenation
operator easily.
It is not possible to use an hash as a resource title. This might be
possible once we support compound resource title.
Unlike the proposed syntax in the ticket it is not possible to assign
individual hash member (mostly to respect write once nature of variable
in puppet).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
| |
Due to the fact that resource.set_parameter is overwriting the previous
set_parameters, we were losing the previous relationships we set there,
either in a previous call of require or in the same call.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
| |
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This refactor fixes about a quarter of the test failures on master and (I
hope) will simplify some of the integration issues on the testing branch.
It is my best guess at The Right Thing To Do (or at least a step in that
direction) but I could be persuaded otherwise.
The basic idea is to take responsibility for maintaining scope hierarchy and
class_name -> class_scope mapping out of the compiler class and put it in the
scope class where it arguably belongs. To maintain the semantics, class
scopes are all tracked by the "top level" scope, though this could be relaxed
if the nesting semantics were ever needed.
If this winds up being the right thing to do, related routines (e.g. newscope)
should be sorted out as well.
|
|\
| |
| |
| |
| |
| | |
Conflicts:
lib/puppet/ssl/host.rb
spec/spec_helper.rb
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The following manifest doesn't work:
$foo = undef
case $foo {
undef: { notice("undef") }
default: { notice("defined") }
}
This is because "undef" scope variable are returned as an empty
string.
This patch introduces a behavior change:
Now, unassigned variable usage returns also undef.
This might produce some issues in existing manifests, although
care has been taken to allow correct behavior in the most commonly
used patterns.
For instance:
case $bar {
undef: { notice("undef") }
default: { notice("defined") }
}
will print "undef".
But matching undef in case/selector/if will also match "".
case $bar {
"": { notice("empty") }
default: { notice("defined") }
}
will print "empty".
Of course "" doesn't match undef :-)
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
lib/puppet/agent.rb
lib/puppet/application/puppetd.rb
lib/puppet/parser/ast/leaf.rb
lib/puppet/util/rdoc/parser.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is a moderately ugly workaround for the MRI garbage collection
bug (see the ticket for details).
I explored several other potential solutions (notably, monkey
patching the routines that trigger the bug) but none of them were
satisfactory. Monkey patching sub, gsub, sub!, gsub!, etc., for
example, either changes the scoping of $~, $1, etc. in a way that
could potentially subtly change the meaning of programs or (if you
are clever) faithfully reproduces the behaviour of MRI--including
the memory leak.
I decided to go with the standardized and somewhat obnoxious never-
used optional argument as it was easy to automatically insert and
should be even easier to automatically find and remove if a better
fix is developed. It also should be obtrusive enough to escape
accidental removal in refactoring.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This patch fix this bug by adding more to_s methods to ast member
so that puppetdoc can just to_s the AST to reconstruct the original
puppet code.
Of course this is not perfect, but should work most of the time.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| |
| |
| |
| |
| |
| | |
This is just Al's patch with removal of trailing ";"s.
Signed-off-by: Markus Roberts <Markus@reality.com>
|
| |
| |
| |
| | |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
| |
| |
| |
| |
| |
| |
| | |
This patch changes Puppet::Parser::Resource to check if it has been
passed two Puppet::Parser::Resource::Param objects with the same name.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Use of notify() is an error, so replace it with notice, which is a
function. Alternately, notify { msg => '2.6-1 is > than 2.4.5' } could
be used.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
tags
f9516d introduced a change in the way the user tags are persisted
to the database: user tags are now treated as regular tags (they are
stored to the tags table).
Thus this commit changed the AR collector request to also look at the
tags tables when collecting.
Unfortunately this added a performance regression since tag request
were still importing the resources parameters tables and AR was
issuing a large request which was returning all the resource parameters
joined with the tags.
This commit fixes the AR request to join to the needed table, instead
of doing an include. Including (ie eager loading) parameter values was
not working for resource parameters anyway since at least 0.24 because
searching by parameter add a constraint to the joins and only the
searched parameter was returned instead of all parameter for a given
exported resource. So on a performance standpoint this new code should
be as fast 0.24 was.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit extracts these three classes into a single
ResourceType class in the Parser heirarchy, now completely
independent of the AST heirarchy.
Most of the other changes are just changing the interface
to the new class, which is greatly simplified over the previous
classes.
This opens up the possibility of drastically simplifying a lot
of this other code, too -- in particular, replacing the reference
to the parser with a reference to the (soon to be renamed)
LoadedCode class.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|/
|
|
|
|
|
|
|
| |
This patch fix this bug by adding more to_s methods to ast member
so that puppetdoc can just to_s the AST to reconstruct the original
puppet code.
Of course this is not perfect, but should work most of the time.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When code comes in via STDIN or --code ,
Puppet::Util::Settings interpolates $values in the code,
which is probably never the intended behavior.
This is the least destructive fix I could think of:
have Puppet::Parser::Interpreter ask for the uninterpolated value.
More general fixes could be to:
a) Add an escape character to Settings's interpolator, and escape STDIN
b) Add a mechanism to Settings to mark some values as uninterpolated
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
|
|
|
|
|
|
|
|
|
| |
This commit adds any external node classes to the classlist
at compiler initialization, so that at least those classes
will be isolated from any ordering issues encountered when
testing the contents of the class list during compilation.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is my proposed attack on the lexing problem, with a few minor
cleanups to simplify its integration. The strategy:
* Anotate tokens with a method "acceptable?" that determines if
they can be generated in a given context. Have this default
to true.
* Give the lexer the notion of a context; initialize it and
update it as needed. The present context records the name of
the last significant token generated and a start_of_line flag.
* When a token is found to match, check if it is acceptable in
the present context before generating it.
These changes don't result any any change in behaviour but they
enable:
* Give the REGEX token an acceptable? rule that only permits a
regular expression in specific contexts.
The other changes were a fix to the scan bug Brice reported,
adjusting a test and clearing up some cluttered conditions in the
context collection path.
Added tests and subsumed change restricting REGEX to one line.
|
|
|
|
|
|
| |
Use Puppet::Util.execute to run the config_version command and reraise
its potential Puppet::ExecutionFailure exception as a more useful
Pupppet::ParseError
|
|
|
|
|
|
|
|
| |
The #2627 fix was modifying nodename in case of string nodename, but
was removing '_'. Since underscores is a valid character in a class
name, we now allow it.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is not the real fix. It is just an hot-fix to limit
the issue.
The issue is that the lexer regexes have precedences over simple
'/' (divide).
In the following expression:
$var = 4096 / 4
$var2 = "/tmp/file"
The / 4... part is mis-lexed as a regex instead of a mathematical
expression.
The current fix limits regex to one-line.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
| |
I couldn't find a way to make it compatible with
earlier clients, so the docs specify that
it doesn't work with them, and it helpfully fails.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
| |
We broke some cases of metaparam compatibility in 0.25.
Most of it was pretty esoteric, but one thing that wasn't working
was relationship metaparams specified on defined resources.
This adds a compatibility method for older clients.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
| |
We need to be able to do compatibility testing, and this
allows us to do so.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
| |
When we are checking if a node exists before creating a new one
we were also trying to match with regex node names, finding matches
where in fact there is no equality.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
| |
We're converting the regex to a straight name to be used as the node
class name which later on will be used as tag.
It was possible to generate an invalid tag name (containing leading
or successive dots).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This patch rolls up the changeses discussed on the list & the ticket
The fqdn_rand now takes any number of additional arguments of any
type that has a string representation (typically integers or strings)
and concatenats them on to the salt.
The tests have been adjusted to reflect this.
Signed-off-by: Markus Roberts <Markus@reality.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Allow the first argument to the regsubst() function be an array,
and perform regexp replacement on each element of the array in
that case.
This patch also adds more error checking to give better error
messages to the user when given bad parameters.
Signed-off-by: Thomas Bellman <bellman@nsc.liu.se>
|
|
|
|
|
|
|
|
|
| |
The patch that put validity assertions in for module names broke
find_manifest because rather than returning a failure it now rasies
an exception. This patch catches the exception and treats it as
a negative result.
Signed-off-by: Markus Roberts <Markus@reality.com>
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
| |
Before it was undefined, but now we always match
the first defined node.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
| |
The problem was that we were needing to convert
one of the regexes to a string, which wasn't working well.
This adds specific rules for how regexes vs. strings
get compared.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
| |
The 'value' passed to on_error in Puppet::Parser::Parser is a hash, and
we only want to print the 'value' key, rather than a flattened string of
the hash.
|
|
|
|
|
|
|
|
| |
This was broken in the recent refactor around autoloading,
which didn't special-case classes that specified that they
were top-level.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added downcasing into find_or_load (which replaced fqfind) to get
back the old behaviour. Adjusted tests so that they would catch
the problem & confirmed that they fail without the downcasing.
Added tests to confirm the existance of #2493; improved
existing autoload tests (removed inter-test interactions)
and noted (with a TODO) that there was dead code in the
feature loading test; added analogus case sensitivity tests
where apropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
#2507 contains two issues:
* a crash when we filters-out an unwanted resource which had edges
pointing to it.
* resources are losing their virtuality when they are transformed from
Puppet::Parser::Resource to Puppet::Resource. This means we weren't able
to distinguish anymore between an exported resource collected in the same
node as it was exported and an exported resource collected in another node.
The net result is that we can't apply exported resources that are
collected in the same node because they are filtered out by the catalog
filter (see the commits for #2391 for more information).
The fix is to keep the virtuality of the resources so that we can
differentiate those two types of exported resources. We keep this until
the catalog is ready to be sent, where we filter out the virtual resouces
only, the other still exported ones needs to be sent to the client.
To be real sure, the transaction also skips virtual resources.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
| |
This adds a new function shellquote() which can be used for quoting
arguments in shell commands used in the exec type.
This only supports Unixoid operating systems. Other systems would
likely require some other quoting.
Signed-off-by: Thomas Bellman <bellman@nsc.liu.se>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch should fix the race condition causing ticket 2294; it extends the loading logic so that:
* initial load attempts are processed (as before),
* recursive load attempts return immediately (as before),
* but subsequent concurrent load attempts from different threads
wait on a semaphore (condition variable) and then retry (e.g.
use the now-valid results of the first thread).
This is a slight modification of the solution I'd originally proposed, to prevent a deadlock
that could have arisen if three or more threads simultaneously attempted to load the same item.
Though it solves the bug as reported, it has room for improvement:
* Failures aren't cached, so repeated attempts will be made to
import invalid items each time they are encountered
* It doesn't address any of the underlying referential ambiguity
(module vs. filename)
* The threading logic should probably be refactored into a separate
class (as a start I encapsulated it in an ad hoc singleton class,
so at least it isn't cluttering up the load method)
Signed-off-by: Markus Roberts <Markus@reality.com>
|
|
|
|
|
|
|
|
|
| |
These tests tried to load something, verified
the loads didn't work, and then created
the thing to load. This is a bit silly,
so I just removed those sections of the tests.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
| |
This allows you to specify a command used to determine
the catalog version. Also added an integration test
to verify the version cascades.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
| |
This patch enhance AST::HostName to support regexes, and modifies
the parser to allow regex to be used as node name.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>]
|
|
|
|
|
|
|
|
|
| |
This patch uses the unused AST::HostName as the only way to reference
a node in the AST nodes array.
The AST::HostName respect the hash properties of the underlying
string, to keep the O(1) hash properties.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The case and selector statements define ephemeral vars, like 'if'.
Usage:
case statement:
$var = "foobar"
case $var {
"foo": {
notify { "got a foo": }
}
/(.*)bar$/: {
notify{ "hey we got a $1": }
}
}
and for selector:
$val = $test ? {
/^match.*$/ => "matched",
default => "default"
}
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset introduces regexp in if expression with the use of the
=~ (match) and !~ (not match) operator.
Usage:
if $uname =~ /Linux|Debian/ {
...
}
Moreover this patch creates ephemeral variables ($0 to $9) in the current
scope which contains the regex captures:
if $uname =~ /(Linux|Debian)/ {
notice("this is a $1 system")
}
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|