This was necessary because of how I changed file recursion.
The type works much more intelligently now -- files to
be removed have a file resource generated for them, and that
resource handles deletion.
Also fixes#1717; neither age nor size is required now.
Signed-off-by: Luke Kanies <luke@madstop.com>
This way we'll cache when in a transaction, but otherwise always
hit the disk so the data is fresh. This works because we
really only use resources mid-transaction, but it behaves correctly
if we happen to use a resource outside of a transaction.
Signed-off-by: Luke Kanies <luke@madstop.com>
The Catalog is the expirer, which means that a resource
with no catalog will not cache data.
Also switching files to use a cached attribute for its stat.
And modifying catalogs to expire data at the end of every
transaction.
Signed-off-by: Luke Kanies <luke@madstop.com>
Previously you could dynamically use cached values, but the new interface
requires a single static declaration of the attribute:
cached_attr(:myattr) { my_init_code() }
This is cleaner, because it makes it easy to turn the code into an init method
and generally makes the whole thing easier to think about.
Most of this commit is going through the different classes that already using the
Caching engine.
Signed-off-by: Luke Kanies <luke@madstop.com>
Basically, the first generated value was always
considered expired the next time it was asked for.
The fix was to create an initial timestamp in the Cacher
module, thus providing a floor for validity.
This is definitely a murky bug, and is especially hard to
test.
Also refactoring the internals just a bit.
Signed-off-by: Luke Kanies <luke@madstop.com>
It now ignores or removes implicit resources that conflict,
and it yields all resources that are valid.
This makes it simple for calling classes to pass in a list
of resources but only perform a chunk of work for valid (i.e.,
non-conflicting) resources.
This refactor is entirely meant as a way of cleaning up the
Transaction#generate interface to the catalog.
Signed-off-by: Luke Kanies <luke@madstop.com>
This makes a lot of sense because source was always
more of a metaparameter than a property -- it affected
the 'should' values of other properties, but it shouldn't
have done any other work.
It will hopefully make everything else much cleaner.
This is such a large commit mostly because of the need
to fix a lot of tests.
Signed-off-by: Luke Kanies <luke@madstop.com>
This is a significant refactor of some very murky code, and it's
all much cleaner and more readable now. All of the 'newvalue' methods
and any value-related code is in a ValueCollection class.
This puts us in a good position to refactor the Property and Parameter
classes more completely.
Signed-off-by: Luke Kanies <luke@madstop.com>
Previously, parameter values provided by remote sources or default values
were all passed to children, which provided strange state maintenance.
Signed-off-by: Luke Kanies <luke@madstop.com>
Removing obsolete handleignore method
Removing obsolete FileSource class
Removing a now-obsolete test/unit test
Removing a now-obsolete recursive filebucket test
Signed-off-by: Luke Kanies <luke@madstop.com>
This is an unfortunately messy commit; I should have tried harder
to separate the different tasks into different commits, but it's
not worth going back and doing now.
This is the first commit in the long road of fixing the existing file
tests, and in the process refactoring and better testing the code.
The refactoring in this commit is mostly around the 'stat' instance
variable that tests whether the file exists (and provides its metadata
if it does) and the 'insync?' method in the source property.
Signed-off-by: Luke Kanies <luke@madstop.com>
We have to have a CA cert first, because the host will
start using the client cert as soon as it's available,
but it's not functional without a CA cert.
Also removing extra stupid stuff from wait_for_cert --
the connection is now always recycled, which is much simpler.
Signed-off-by: Luke Kanies <luke@madstop.com>
The following manifest wasn't working:
class one {
notice('class one')
}
class one {
notice('second class one')
}
include one
It all boiled down to class code not being arrays.
Encapsulating code in ASTArray when needed is enough to append code,
because of the property of ASTArray to evaluate all their members in
turn.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>