James Shubin
598bec0eab
engine: resources: Clean up var naming and misc in exec
2023-11-28 15:24:11 -05:00
James Shubin
709bf7b246
engine: resources: Add missing WatchCmd UID
...
Not sure if this is even used anywhere, but might as well add it for
now.
2023-11-28 15:24:11 -05:00
James Shubin
2cbce963b7
engine: resources, lang: funcs, parser: Add panic magic
...
It's valuable to check your runtime values and to shut down the entire
engine in case something doesn't match. This patch adds some magic
plumbing to support a "panic" mechanism.
A new "panic" statement gets transparently converted into a panic
function and panic resource. The former errors if the input is not
empty. The latter must be present to consume the value, but doesn't
actually do anything.
2023-11-28 13:49:31 -05:00
James Shubin
dad3458ece
mod: Try and update things
...
No idea why things break. go.mod sucks.
2023-11-27 21:00:03 -05:00
James Shubin
0e2c73a36d
engine: resources: Reduce logging for file resource
2023-11-27 19:57:54 -05:00
James Shubin
ee88161808
engine: graph, resources: Reduce and clean up logging
...
Make the output more usable.
2023-11-22 22:37:35 -05:00
James Shubin
04d54e8d82
engine: resources: Mask normal closing error
...
This could possibly be fixed upstream, but we'll workaround it for now.
2023-11-22 22:11:50 -05:00
James Shubin
f4d70068b1
engine: resources: Add a default NBP option to dhcp:server
...
This let's us do some overrides and is a good alternative since
send/recv+autogrouping doesn't work yet.
2023-11-22 20:22:50 -05:00
James Shubin
3fe5a8d0d6
mod: Update tftp libraries
2023-11-22 20:21:40 -05:00
James Shubin
6670407c9c
engine: resources: Make net resource reversible
...
This allows the net resource to be reversible if we want it to be. It
only flips the network state from up to down or vice-versa.
2023-11-22 20:21:40 -05:00
James Shubin
641b6067cd
engine: resources: Remove net config file on down
...
This cleans up the file we would have created when building the resource.
2023-11-22 20:21:40 -05:00
James Shubin
b1d61fa90b
engine: resources: Ignore cleanup errors that don't matter
...
If the file is already gone, ignore it.
2023-11-22 20:21:40 -05:00
James Shubin
0c93cf2600
engine: resources: Add constants for state up and down
...
Safer and cleaner code.
2023-11-22 20:21:40 -05:00
James Shubin
53753c0932
engine: resources: Improve net error messages
...
This is a common case of parse failures for not using CIDR. Make it
cleaner for the user.
2023-11-22 20:21:40 -05:00
James Shubin
029cfaf1f8
engine, lib: Misc log and comment changes
...
Just misc polishing.
2023-11-22 20:21:40 -05:00
James Shubin
66edc39ccb
engine: resources: Improve exec docs
...
So that I don't hit this too often.
2023-11-22 20:21:40 -05:00
James Shubin
3f42f785ac
engine: resources: Handle recurse field more appropriately
...
This smoothes out some edge cases. We should add comprehensive tests in
the future.
2023-11-22 20:21:40 -05:00
James Shubin
fd4d32351b
engine: resources: Refactor file mode code
...
Small cleanup in old code.
2023-11-22 20:21:40 -05:00
James Shubin
75d3895e84
engine: Improve logging for resources and exec
...
This makes things a bit clearer and fixes some silly formatting bugs.
2023-11-22 20:21:40 -05:00
James Shubin
d022d7f09e
engine: resources: Rename the value field in value resource
...
Having a different name makes it more obvious, and also leaves us open
to add a string or bool field for more explicit typing.
2023-11-18 15:15:33 -05:00
James Shubin
88b414b9a3
engine: resources: Add new value resource
...
This is a strange resource which is probably most useful for passing
values between scopes. It supports a variant resource field, and should
only be used as a last resort and if you know exactly what you're doing.
2023-11-18 14:23:31 -05:00
James Shubin
7105e38544
engine: util: Remove the ValueOf hack
...
We've got something in the core utility function now.
2023-11-18 13:45:46 -05:00
James Shubin
4b0cdf9123
lang: types, engine: graph: Support pointer interfaces
...
If we have rare, but special *interface{} values in resource structs, we
should be able to handle them normally. It's really not recommended that
you use these unless you know exactly why they are useful.
2023-11-18 13:35:52 -05:00
James Shubin
1c9fdc79c0
engine: util: Add a workaround for printing special resources
...
This let's our tests compare strings of interface fields!
2023-11-18 13:35:52 -05:00
James Shubin
90d04990ca
engine, lang: Add an AST test that looks at fields too
...
This gives us more options for testing when we need those kinds of more
extensive resource examination features.
2023-11-18 13:35:52 -05:00
James Shubin
aa001ed2dc
engine: graph: Improve error message for rare case
...
Not sure if we ever hit this, but we should fix it up since I noticed
it.
2023-11-18 13:35:52 -05:00
James Shubin
3a3bc568b3
engine: Allow more send/recv cases
...
This allows the other part of this. This still needs to be improved, but
it unblocks some use-cases.
2023-11-12 17:50:07 -05:00
James Shubin
b048b2684b
engine, lang: Allow resources with a field of type interface
...
This lets us add a resource that has an implementation with a field
whose type is determined at compile time. This let's us write more
flexible resources.
What's missing is additional type checking so that we guarantee that a
specific resource doesn't change types during run-time.
2023-11-12 17:25:03 -05:00
James Shubin
9a1a81925e
engine: Improve error messages for ambiguity
...
This appears twice, make each one unique.
2023-11-12 17:09:50 -05:00
James Shubin
4fb356b19b
engine: graph: Refactor the send/recv code to inline it
...
This is useful subsequently.
2023-11-12 16:13:04 -05:00
James Shubin
cb6b8a9670
engine: util: Refactor code for future changes
...
This makes things a bit cleaner and easier to follow and accepts future
patches easier.
2023-11-12 15:26:44 -05:00
James Shubin
cb999af653
engine: Improve debugging for invalid send/recv res
...
If we don't implement send/recv properly, at least give the user more
information as to where.
2023-11-12 15:21:08 -05:00
James Shubin
8d7d2fb1f1
engine: resources: Add missing struct tags for password res
...
Just noticed these.
2023-11-04 16:59:09 -04:00
James Shubin
e37876afec
engine: resources: Small formatting cleanups
2023-10-07 11:44:47 -04:00
James Shubin
738485a655
etcd: Add world API changes for watching member status
...
This adds some useful functionality so that anyone with access to the
world API, can learn information about the changing etcd cluster it's
using.
2023-09-29 20:46:36 -04:00
James Shubin
089267837d
engine: graph: Add a lock around metas access
...
We forgot about the concurrent writes. This should fix that.
2023-09-19 13:46:20 -04:00
James Shubin
c851322826
engine: resources: Fix up test resource
...
Woops...
2023-09-19 09:12:59 -04:00
James Shubin
6c0775ba59
engine: resources: Consider passing in funcs if possible
...
Let this sit in the test resource for now.
2023-09-04 16:33:05 -04:00
James Shubin
0d381e4c91
engine: graph: Handle the back poke differently
...
A back poke is the deferral or delay of a Process/CheckApply. This is
because we notice that we're not truly ready to CheckApply due to some
timestamp issue. When Process errors, we should accept that, but not
treat it as a success.
2023-09-04 15:22:14 -04:00
James Shubin
7ccda7e99b
engine: Add a ctx to the CheckApply API
...
This is just a rough port, there are lots of optimizations to be done
and lots of timeout values that should be replaced by a new timeout meta
param!
2023-09-02 01:34:42 -04:00
James Shubin
567de2e115
engine: Use a struct instead of a compound string for resUID
...
This struct combination of resource kind+name is suitable for use as a
unique map key.
2023-09-02 01:34:42 -04:00
James Shubin
cf49a9a6e7
engine: graph: Give retry channel its own signal
...
This just makes the copy+pasting less confusing.
2023-09-02 00:59:48 -04:00
James Shubin
41493993a2
engine: resources: Respect the apply variable
...
Woops!
2023-09-01 22:51:44 -04:00
James Shubin
1d10f85c28
engine: graph: Move misplaced comment
2023-09-01 22:13:34 -04:00
James Shubin
d3d84524f5
engine: graph: Improve limit output
...
Just show the milliseconds, and round it slightly.
2023-09-01 21:57:05 -04:00
James Shubin
cc04221516
engine: graph: Allow pause/resume while in retry or limit
...
The retry and limit "satellite" event loops didn't allow pausing or
resuming, and instead you needed to wait until either was done before
you could pause.
The downside of this patch is that for very fast graph transitions, we
wouldn't be really obeying the limits anymore, however now that we have
per resource kind+name uid, we can persist the limits across graph swaps
if we want to.
Most importantly, this allows us to exit entirely when we're stuck in
one of these satellite loops.
2023-09-01 21:57:05 -04:00
James Shubin
f9bc50e262
engine: Retry should be stateful and add RetryReset
...
Make the retry meta param a bit more sane now that we can persist it
between graph switches. This also unblocks us from pausing during retry
loops.
2023-09-01 21:57:05 -04:00
James Shubin
9545e409d4
engine: Create a resource kind+name specific stateful store
...
This adds a meta state store that is preserved between graph switches if
the kind and name match. This is useful so that rapid graph changes
don't necessarily reset their retry count if they've only changed one
resource field.
2023-09-01 21:57:05 -04:00
James Shubin
07bd8afc4a
engine: graph, metaparams: Default rewatch to false
...
The frequency of graph changes makes it unlikely that you want this
enabled on most resources by default.
2023-09-01 19:02:11 -04:00
James Shubin
8299c04fc6
engine: graph, util: Clean up error printing
...
We should improve on this more, but at least as a quick fix, stop
splitting the error across two lines. This makes the logs really ugly.
2023-09-01 16:53:40 -04:00