I expect these failed in master but not 0.24.x because I'm
better about stubbing calls to Facter in master.
I stubbed these enough that they should continue to
work.
Signed-off-by: Luke Kanies <luke@madstop.com>
I was getting failing tests because I was using non-files
for testing and they didn't back up the same, not
surprisingly.
This moves the 'backup' method to the :flat filetype
and then only backs up if the filetype supports it.
Signed-off-by: Luke Kanies <luke@madstop.com>
It was previously just a warning, but the node
is essentially non-functional without the facts,
so it makes more sense for it to be a warning.
Signed-off-by: Luke Kanies <luke@madstop.com>
At this point, the server's behaviour is a bit undefined
if it tries to compile the catalog with no facts
locally. The next commits will fix that.
Signed-off-by: Luke Kanies <luke@madstop.com>
Also fixing the argument order while downloading
either of them. I had my Downloader.new
calls using the wrong argument order.
Signed-off-by: Luke Kanies <luke@madstop.com>
While evaluating the AST, catalog vertices are not always ordered
the same way on different run, leading to some tags (which should
have been applied in evaluation order) to not be associated with
some underlying resources.
This changeset change all accesses to resources inside the compiler
to always use an ordered (in evaluation order) list of added
resources.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
This moves responsibility for backups from the filetype
to the consumer of the filetype, but only ParsedFile actually uses
filetypes.
Signed-off-by: Luke Kanies <luke@madstop.com>
There were apparently some circumstances that
resulted in the connection not being closed; this just closes
it every time if it's still open after the rpc call is complete.
Signed-off-by: Luke Kanies <luke@madstop.com>
I split it all into smaller, manageable chunks,
and used methods for each step, instead
of having one huge call.
Note that I made all of the tests first, then
refactored the code, so I'm confident there's no
behavior change.
I don't know that this is actually a lot cleaner,
but it seems that way to me. I'm open to
skipping this, but I think it makes the whole thing
a lot cleaner.
Signed-off-by: Luke Kanies <luke@madstop.com>
Ruby's exception hierarchy is a bit strange, in that only
exceptions that sub RuntimeError are caught by default.
This patch explicitly catches the base class, Exception,
which means that LoadError, SyntaxError, and any
RuntimeErrors will all be caught.
This is done for both load() and loadall(); load() uses
Kernel.load, but loadall() uses Kernel.require.
Signed-off-by: Luke Kanies <luke@madstop.com>
This was caused by the fix to #1472. That fix unexported
any resources collected from the local catalog.
The crux of this fix is that it separates 'exported'
and 'virtual' a bit more. It also removes no-longer-needed
functionality where resources copied their virtual or
exported bits from the enclosing define or class. This is
now obsolete because we don't evaluate virtual defined resources.
The crux of this commit is that defined resources can stay
exported even though they're evaluated, and that exported state
won't inherit to contained resources such that those then don't
get evaluated.
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>
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>
This changes the hooks provided via the Indirector Request
for determining how the cache is used. These hooks are only
used by the Configurer class. They're messy, but I can't
come up with a better design, and they're at least sufficient.
Signed-off-by: Luke Kanies <luke@madstop.com>
This makes it so we can easily create and use lots
of agent instances, rather than having a single
global instance with shared state.
Signed-off-by: Luke Kanies <luke@madstop.com>
This replaces the short-lived EventManager class, all of
the service- and timer-related code in puppet.rb, and moves
code from agent.rb, server.rb, and other places into one
class responsible for starting, stopping, pids, and more.
The Daemon module is no longer in existence, so it's been
removed from the classes that were using it.
Signed-off-by: Luke Kanies <luke@madstop.com>
This broke in a previous commit, and was apparently not
tested well because of how the mocks were set up. The
integration test caught it.
Signed-off-by: Luke Kanies <luke@madstop.com>