James Shubin
32916f9a6f
engine: resources: Receive keys should match mcl, not golang
...
The capitalization of these keys was wrong and they weren't getting
seen. Add a test as well.
2024-01-22 19:40:15 -05:00
James Shubin
b670bb8d2c
engine: resources: http: Recurse on Init and Watch
...
Make this resource handle sub-resources more powerfully.
2024-01-22 19:16:28 -05:00
James Shubin
1abf6547ff
engine: resources: http: Improved CheckApply for grouped resources
2024-01-22 19:16:28 -05:00
James Shubin
3739fa401e
engine: resources: Refactor HTTP constants
2024-01-22 17:43:24 -05:00
James Shubin
377d62999f
engine: resources: The kv resource can set un-mapped values
...
Previously the resource could only set values in a per-hostname
namespace, but for single, user-managed values, we'd like to be able to
control things entirely. Now this resource can do that.
2024-01-22 17:43:24 -05:00
James Shubin
b4bb4ca397
engine: resources: Update kv error messages
2024-01-22 17:43:24 -05:00
James Shubin
6b4fb434da
engine: resources: Rename var
...
More accurate.
2024-01-22 17:43:24 -05:00
James Shubin
9e70f53afa
engine: resources: Add missing apply guard
2024-01-22 17:43:24 -05:00
James Shubin
81885dec63
engine: resources: Add some spacing
2024-01-22 17:43:24 -05:00
James Shubin
a8f194259b
legal: Happy 2024 everyone...
...
Done with:
ack '2023+' -l | xargs sed -i -e 's/2023+/2024+/g'
Checked manually with:
git add -p
Hello to future James from 2025, and Happy Hacking!
2024-01-22 15:52:49 -05:00
James Shubin
271a94e0c7
engine: resources: Improve logging on resource errors
...
When a subcommand errors, it's helpful to see what it was.
2023-12-03 21:21:55 -05:00
James Shubin
b7d8a769db
lang: funcs: core: Add value functions
...
This adds a new series of "get*" functions which can read values from
the associated "value" resources. The key name of the function must
match the name value of the resource for things to work.
Type unification isn't yet perfect in these scenarios, so you should use
casually and with caution.
2023-12-03 18:24:20 -05:00
James Shubin
984fb702e5
engine: resources: Make test resource easier for debugging
...
Let some fields not get printed if we request it.
2023-12-03 18:02:00 -05:00
James Shubin
b8d391024a
engine: resources: Add a DoneCmd feature for exec resource
...
This makes a common pattern of `$cmd && echo done > /tmp/donefile` much
clearer and easier.
2023-11-28 15:24:22 -05:00
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
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
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
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
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
41493993a2
engine: resources: Respect the apply variable
...
Woops!
2023-09-01 22:51:44 -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
c1850e0e20
engine: resources, lang: Set resource fields more accurately
...
There were some bugs about setting resource fields that were structs
with various fields. This makes things more strict and correct. Now we
check for duplicate field names earlier (duplicates due to identical
aliases) and we also don't try and set private fields, or incorrectly
set partial structs.
Most interestingly, this also cleans up all of the resources and ensures
that each one has nicer docs and a clear struct tag for fields that we
want to use in mcl. These are mandatory now, and if you're missing the
tag, then we will ignore the field.
2023-08-26 01:11:50 -04:00
James Shubin
514927c0b3
engine: resources, graph: Change the Close method to Cleanup
...
This also changes a few similarly named methods. Clearer what it's doing
in terms of cleanup vs. causing some action.
2023-08-08 01:11:29 -04:00
James Shubin
63f05e12ca
engine: resources: net: Clean up weird error handling
...
Not sure how this happened.
2023-08-08 01:11:29 -04:00
James Shubin
b87d70c71c
engine: resources: Move wait out of Close method
...
Watch should wait until everything is done before exiting.
2023-08-08 01:11:29 -04:00
James Shubin
00a37b6289
engine: resources: config_etcd: Fix missing return
...
Woops!
2023-08-08 01:11:29 -04:00
James Shubin
963393e3d9
engine: graph, resources: Change Watch to use ctx
...
This is a general port. There are many optimizations and cleanups we can
do now that we have a proper context passed in. That's for a future
patch.
2023-08-08 01:11:29 -04:00
James Shubin
53a878bf61
engine: resources, graph: Change the done channel into a ctx
...
This is part one of porting Watch to context.
2023-08-08 01:11:29 -04:00
James Shubin
5eac48094b
engine: resources: Disable broken docker test
...
It's not my fault it broke, afaict!
2023-08-08 01:11:29 -04:00
James Shubin
c5efe7a17b
lang, engine: Remove unneeded error wrapping
...
These situations basically never fail, and if they do, we certainly
don't need more context. This simplifies things a bit.
2023-04-20 18:02:40 -04:00