Mostly renaming 'obj' to 'resource', since the whole
'obj' thing is a holdover from before we had the
term 'resource'.
Also pulling a bit of code out of a loop, since it
didn't need to be there.
Signed-off-by: Luke Kanies <luke@madstop.com>
The following snippet:
realize( File["/tmp/a","/tmp/b"] )
is parsed into:
AST::Function @name=realize @arguments=
AST::ASTArray @children = [
AST::ResourceReference @title= AST::ASTArray @children = [
String(/tmp/a), String(/tmp/b)
]
]
When evaluated:
ResourceReference gives -> [ File[/tmp/a], File[/tmp/b] ]
which means the function arguments are:
[[File[/tmp/a], File[/tmp/b]]
after evaluating the @arguments ASTArray of AST::Functions.
Then the collector complains that it can't find the resource
because it is not supposed to work on non-flattened resource
array.
The fix is to flatten in the realize function (although it can
be done more generally in the AST::Function evaluation) before
the resources are given to the Collector.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
The following manifest:
$groups = ["foo", "bar"]
$type_groups = ["baz", "quux"]
$user_groups = [$groups, $type_groups]
notify{ $user_groups: }
which outputs:
notice: foo
notice: //Notify[foobar]/message: defined 'message' as 'foo'
notice: baz
notice: //Notify[bazquux]/message: defined 'message' as 'baz'
is not equivalent to
$user_groups = [ ["foo", "bar"], ["baz", "quux"] ]
notify{ $user_groups: }
which outputs:
notice: foo
notice: //Notify[foo]/message: defined 'message' as 'foo'
notice: baz
notice: //Notify[baz]/message: defined 'message' as 'baz'
notice: bar
notice: //Notify[bar]/message: defined 'message' as 'bar'
notice: quux
notice: //Notify[quux]/message: defined 'message' as 'quux'
Obviously the second one manages to flatten the arrays and not the
first one.
This changeset adds flattening to the resource titles evaluations
in order to be consitent in all cases.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Revert "Fix #1682 - ASTArray should flatten product of evaluation of its children"
This reverts commit c7ccc4ba7c.
Bug #1824 and #1922 proved the fix for #1682 and #1691 was wrong.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
*only* if you use the default configuration file locations.
In the end, this was a relatively minor change; most of the actual
diff centers around making the code more readable so I could think
my way into the fix, and adding tests for cases that were either
untested or refactored slightly.
Signed-off-by: Luke Kanies <luke@madstop.com>
For some reason, Puppet::Type#evaluate was calling
'prefetch' on instances that support it, but prefetching
is only a class-level functionality, normally -- in fact, it makes
no sense unless done at the class level.
This patch just removes the code.
Signed-off-by: Luke Kanies <luke@madstop.com>
Some releases of git no longer install hundreds
of binaries, so the 'git-format-patch' binary
is unavailable.
Signed-off-by: Luke Kanies <luke@madstop.com>
I wanted to include a snide remark in the error, but...
Now you just get an exception when creating the user if
the password includes this character.
Signed-off-by: Luke Kanies <luke@madstop.com>
The rationale behind this patch is that it takes a lots of time
to let rails unserialize the ParamValue and ResourceTag object
on each compilation, just to throw them away the second after.
The idea is to fetch directly (and batched host per host) the
parameters and tags from the database and then returns them as
hash.
This allows the no-modification case to takes at least 2 times
less than before.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
The temporary file was not actually useful, because we
could never really get atomic renames, for annoying,
complicated reasons.
This hopefully finally fixes#1812.
Signed-off-by: Luke Kanies <luke@madstop.com>
It is now more likely to fail if there's a problem,
since the yaml should be corrupt, causing a yaml failure.
Also removing the equivalent test from the Storage module.
Signed-off-by: Luke Kanies <luke@madstop.com>
It's obviously not really possible to test that this fixes it,
but I'm confident that the locks work, and now we're using them,
so it *should*.
Signed-off-by: Luke Kanies <luke@madstop.com>
The nagios object definitions have been updated to correlate with Nagios
3.0.6.
In Nagios it is possible to have multiple service checks with the
same service_description. eg I could have an check with a
service_description of 'SSH' for multiple hosts. So in puppet we can't
use it as a unique name for the resource. This patch modifies the code
to use $name as the unique name. For some types eg command_name $name
ends up in the config and thus we can tell which puppet resources match
to which nagios ones. For other types like service there is no direct
mapping from $name to a nagios attibute. So we use a custom attribute
called _naginator_name.
Signed-off-by: John Ferlito <johnf@inodes.org>
The nagios object definitions have been updated to correlate with Nagios
3.0.6.
In Nagios it is possible to have multiple service checks with the
same service_description. eg I could have an check with a
service_description of 'SSH' for multiple hosts. So in puppet we can't
use it as a unique name for the resource. This patch modifies the code
to use $name as the unique name. For some types eg command_name $name
ends up in the config and thus we can tell which puppet resources match
to which nagios ones. For other types like service there is no direct
mapping from $name to a nagios attibute. So we use a custom attribute
called _naginator_name.
Signed-off-by: John Ferlito <johnf@inodes.org>