| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
Add a regex rule (unused for the moment) to the parser.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
| |
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
| |
The lexer recognizes regex delimited by / as in:
/^$/
The match operator is defined by =~
The not match operator is defined by !~
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
| |
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
| |
Those variables have been created to be short lived and used mainly
to define temporary special variables.
They do not persist after a call to unset_ephemeral_var.
Also Scope#set_ephemeral_from can be used to promote a regexp
MatchData to ephemeral values.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
| |
AST nodes don't have a valid to_s that is producing a correct
representation of said node.
This patch adds some of the AST node to_s to produce correct
values that can be used verbatim by puppetdoc to render
the documentation.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were getting strange dependency cycles because our class structure
mirrored our scope structure. We can't change the scope structure
without switching from a dynamically scoped language to a lexically scoped
language, which is too big of a change to make right now. Instead,
I'm changing the resource graph so that all classes default to just
having an edge to the 'main' graph.
This will be a behaviour change for many, in that you were getting
automatic dependencies from this old behaviour, but it will bring
consistency.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
| |
Since there isn't any unit test for puppetdoc rdoc code (my fault),
nobody noticed it was using direct access to the parser AST array.
This changeset fixes the way puppetdoc uses the parser results.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to the problem that we associate documentation in the lexer and
not in the parser (which would be to complex and unmaintenable to
do), and since the parser reads new tokens before reducing
the current statement (thus creating the AST node), we could
sometimes associate comments seen after a statement associated
to this one.
Ex:
1. $foo = 1
2. # doc of next class
3. class test {
When we parse the first line, the parser can reduce this to the
correct VarDef only after it lexed the CLASS token.
But lexing this token means we already pushed on the comment stack
the "doc of next class" comment.
That means at the time we create the AST VarDef node, the parser thinks
it should associate this documentation to it, which is incorrect.
As soon as the parser uses token line number, we can enhance the lexer
to allow comments to be associated to current AST node only if
the statement line number is greater or equal than the last comment
line number.
This way it is impossible to associate a comment appearing later in the
source than a previous statement.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Careful inspection of the parser code show that when we
associate a source line number for an AST node, we use the
current line number of the currently lexed token.
In many case, this is correct, but there are some cases where
this is incorrect.
Unfortunately due to how LALR parser works the ast node creation
of a statement can appear _after_ we lexed another token after
the current statement:
1. $foo = 1
2.
3. class test
When the parser asks for the class token, it can reduce the
assignement statement into the AST VarDef node, because no other
grammar rule match. Unfortunately we already lexed the class token
so we affect to the VarDef node the line number 3 instead of 1.
This is not a real issue for error reporting, but becomes a real
concern when we associate documentation comments to AST node for
puppetdoc.
The solution is to enhance the tokens lexed and returned to the parser
to carry their declaration line number.
Thus a token value becomes a hash: { :value => tokenvalue, :line }
Next, each time we create an AST node, we use the line number of
the correct token (ie the foo line number in the previous example).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
| |
I also took the opportunity to clean up and simplify
the interface to the parts of the parser that interact
with this. Mostly it was method renames.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
| |
This class is extracted from the Parser class,
and the main driver for it is to enable us to put mutexes
around some of the hashes to see if they're the source
of a race condition.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
| |
Comments and multi-line comments produces no token per-se during
lexing, so the lexer loops to find another token.
The issue was that we were not skipping whitespace after finding
such non-token.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
| |
Bellman)
|
|
|
|
|
|
|
|
|
| |
We were previously throwing exceptions.
This also ports all of the tests for variable lookup
over to rspec.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
| |
Adding the tags to the rails collect query can reduce performance
because there are 2 more tables to join with.
So we make sure to include tags in the query only when it is
necessary.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
| |
This is so that overriding the "tag" metaparameter ends-up in the
resource tags on the server.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
| |
This function acts exactly as the 'include' function, but also
adds an ordering relation between the included class and the class
where the require function is.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Up to now, when trying to match with tags:
File<<| tag == 'value' |>>
in fact we were querying parameters. Hopefully all the user tags
are stored in parameters so it was working.
But it wasn't possible to search on auto-tags (like class name).
This patch makes sure searching by tag is done on tags both on the
rails side and the resource side.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
| |
It appears that resources were not tagged with user tag on the
server, which prevents those tags to be persisted as tag in
the storeconfigs.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
I don't know why we imposed the restriction that we shouldn't match
with parameter containing arrays in exported mode.
That doesn't seem right, as the produced rails query works fine with
arrays.
Note: the user tags are not stored in the rails database except under
the special resource parameter tag. This also doesn't seem right.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| |
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
|
|
|
|
|
| |
This commit should have no functional effect.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
| |
This somehow got lost in the conversion from
Parser resources to Puppet resources. We now
copy over the 'exported' value.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the behaviour of template searching a bit -
we previously usually returned a file name, whether the template
existed or not. Now we only return a path if it
exists.
Refactoring a few of the the tests for TemplateWrapper, also.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, when you created a module you had to specify
the path. Now Module instances can use the module path
to look up their paths, and there are methods for determining
whether the module is present (if the path is present).
Also cleaned up the methods for figuring out what's in
the module (plugins, etc.).
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
| |
The Module class had a bunch of code for finding
manifests and templates even when not in a module,
and it complicated the class unnecessarily. This
moves that code to a new, hackish-but-sufficient
module for just that purpose.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
| |
Also working around a YAML bug in Ruby.
And fixing tests that were broken in a previous commit
in this rebase but not caught earlier.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
| |
This moves all code from the Parser class into
the ActiveRecord classes, and gets rid of
'ar_hash_merge'.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This is mostly a configuration change, with some
code getting removed.
Also adding an extra require in Format;
Puppet::Provider requires Puppet::Provider::Confiner,
so the constant lookup is weird.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because we now pass catalogs around, rather than a tree
of resources, we no longer lose the metaparam information
in definitions and classes. Thus, we no longer need
to pass them down to contained resources.
Ideally we'd remove cascading of all metaparams (which is
ticket #1903) but 'schedule' and 'noop' are inherently
recursive but not in a way that the graph support can currently
easily solve, so that's going to have to wait for a later
release.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|\ |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
indentation of doc strings must be retained.
Signed-off-by: Thomas Bellman <bellman@nsc.liu.se>
|
| |
| |
| |
| | |
Signed-off-by: Luke Kanies <luke@madstop.com>
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
bin/ralsh
lib/puppet/executables/client/certhandler.rb
lib/puppet/parser/functions/versioncmp.rb
lib/puppet/parser/resource/reference.rb
lib/puppet/provider/augeas/augeas.rb
lib/puppet/provider/nameservice/directoryservice.rb
lib/puppet/provider/ssh_authorized_key/parsed.rb
lib/puppet/type.rb
lib/puppet/type/file/checksum.rb
spec/integration/defaults.rb
spec/integration/transaction/report.rb
spec/unit/executables/client/certhandler.rb
spec/unit/indirector/ssl_rsa/file.rb
spec/unit/node/catalog.rb
spec/unit/provider/augeas/augeas.rb
spec/unit/rails.rb
spec/unit/type/ssh_authorized_key.rb
spec/unit/type/tidy.rb
test/executables/filebucket.rb
test/executables/puppetbin.rb
|
| |
| |
| |
| | |
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| |
| |
| |
| |
| |
| |
| | |
Some invalid numbers were treated as numbers and conversion to Integer
was failing returning 0 (for instance 0.24.7).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit just replaces the :file and :line accessors
with the use of the new FileCollection Lookup module.
This should mean that we've normalized all file names in
a given process, which *might* have drastic RAM improvements.
For initial simplicity, I've gone with a single global
collection of file names, but it's built so it's easy to use
individual file collections instead.
Signed-off-by: Luke Kanies <luke@madstop.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Resource parameters of the form
[Res[a], Res[a,b]] ends being evaluated as
[Res[a], [ Res[a], Res[b] ]
This last form was not flattened when transfomed into RAL
type, which in turn prevented the sub array to be converted
in regular resource references.
Thus the type was choking when encountering those native
parser references instead of usual resource reference.
The fix consists in flattening array of references before
transformation to trans objects for RAL.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This changeset defines a new syntax to override collection
of resources (virtual or not). This feature is not constrained
to the override in inherited context as usual resource
override.
The collection of resource supports a query like regular collection
of virtual or exported resources.
Usage example:
file {
"/tmp/testing": content => "whatever"
}
File<| |> {
mode => 0600
}
It also introduces a different behaviour for collection of catalog
resources. Before this patch, only virtual resources were collected,
now all resources (virtual or no) are collected and can be overriden.
That means it is now possible to do:
File <| |> { mode => 0600 }
And all the Files resources will have mode 0600.
It is then possible to have this puppet pattern:
file { "/tmp/a": content => "a" }
file { "/tmp/b": content => "b" }
File <| title != "/tmp/a" |> {
require => File["/tmp/b"]
}
which means that every File requires a file.
Moreover it is now possible to define resource overriding
without respecting the override on inheritance rule:
class a {
file {
"/tmp/testing": content => "whatever"
}
}
class b {
include a
File<| |> {
mode => 0600
}
}
include b
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
|