James Shubin
3e31ee9455
legal: Additional permission under GNU GPL version 3 section 7
...
With the recent merging of embedded package imports and the entry CLI
package, it is now possible for users to build in mcl code into a single
binary. This additional permission makes it explicitly clear that this
is permitted to make it easier for those users. The condition is phrased
so that the terms can be "patched" by the original author if it's
necessary for the project. For example, if the name of the language
(mcl) changes, has a differently named new version, someone finds a
phrasing improvement or a legal loophole, or for some other
reasonable circumstance. Now go write some beautiful embedded tools!
2024-03-05 01:04:09 -05:00
James Shubin
dd0e67540f
all: Remove deprecated io/ioutil package
...
Porting everything to the newer imports was trivial except for one
instance which required a very small refactor.
2024-02-28 16:36:49 -05:00
James Shubin
26bce5ddc0
engine: resources: Add a new http:proxy resource
...
This adds a new caching http proxy resource that can be autogrouped into
the core http:server resource, and which caches and serves files that it
received from a different http server. It first pulls them down when
they are initially requested, which makes it possible for us to use this
for provisioning a Linux installation without having to pre-rsync the
entire package repository.
2024-02-22 13:15:39 -05:00
James Shubin
bd708159a1
engine: resources: Close files after use
...
Don't need to wait for gc.
2024-02-22 13:15:39 -05:00
James Shubin
87ce637bd2
engine: resources: Add a helper function for creating errors
2024-02-22 13:15:39 -05:00
James Shubin
7698b1b5fd
engine: resources: Add an http error wrapper
...
This makes it easier to return errors more succinctly.
2024-02-16 08:06:20 -05:00
James Shubin
e256d886e0
engine: resources: Add a fancy http error wrapper
...
This lets use use a regular error signature but also specify which http
error code we want to return.
2024-02-16 08:06:20 -05:00
James Shubin
6f268e3a40
engine: resources: Fix up docstring
...
This was a copy+pasta mistake.
2024-02-16 08:06:20 -05:00
James Shubin
d0d6a4d1a1
engine: resources: Log some tftp errors
...
This was helpful in debugging.
2024-01-31 13:09:58 -05:00
James Shubin
961370c43c
engine: resources: Log dhcp mac addresses
...
Useful for identifying who is trying to connect when they're not in the
system yet.
2024-01-31 13:09:58 -05:00
James Shubin
7e1a4dea6c
engine: resources: The http:file resource should allow directories
...
This expands the use of the http:file resource to allow it to be used as
a directory root.
2024-01-28 23:16:25 -05:00
James Shubin
67c72a0e86
engine: resources: Add an http:flag resource
...
This adds a new http:flag resource which can autogroup into an
http:server resource to receive actions from client HTTP requests, and
forward these values on to other resources.
2024-01-22 20:37:53 -05:00
James Shubin
0711d05232
engine: resources: http: Improve groupability of resources
...
This improves groupability of http resources so that we can have fancier
kinds!
2024-01-22 20:37:53 -05:00
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