Commit Graph

2037 Commits

Author SHA1 Message Date
James Shubin
e7b57a32fd engine: resources: Add a tar resource
This makes tar archives from a list of files and/or directories. It
correctly includes empty directories as well. The code structure is
similar to the gzip resource. While this resource is arguably more
useful than gzip, it was invaluable to write the gzip resource first
since that made writing this one much easier.
2024-09-13 20:04:53 -04:00
James Shubin
06cc63fcb6 util: recwatch: Add a helper function for merging these
I should really rework the recwatch package and API, but I wasn't in the
mood to touch this code today, so this will have to do for now.
2024-09-13 19:48:00 -04:00
James Shubin
e34212a10b engine: resources: gzip: Check unhandled error
This is probably inconsequential, but let's do it since it's not in a
defer.
2024-09-13 19:48:00 -04:00
James Shubin
5f6e07b5e8 engine: resources: gzip: Fix typo 2024-09-13 16:24:01 -04:00
James Shubin
1465c5cdc9 engine: resource: gzip: Remove unneeded waitgroup
I think this was a copy+pasta mistake.
2024-09-13 16:13:03 -04:00
James Shubin
29eebd0d07 lang: core: Move template to golang namespace
I don't think this template function should be in any way authoritative,
so let's namespace it.
2024-09-13 15:51:24 -04:00
James Shubin
5bbc06d8bc engine: resources: Add new gzip resource
This may have lots of uses, particularly for bootstrapping and handoff
if we want to compress payloads. It is also a good model resource for
how to implement such a resource to avoid re-computing the result on
every CheckApply call. Of course if the computation is cheaper than the
hashing of the data this isn't the optimal approach.
2024-09-13 03:32:10 -04:00
James Shubin
9a5f6a5bd3 lang: core, funcs: Use the correct zero type
I wasn't using the correct contained type here.
2024-09-10 23:23:00 -04:00
James Shubin
2e774215e4 lang: core: deploy: Add a function to get the binary path
Useful for bootstrapping new machines.
2024-09-10 23:22:53 -04:00
James Shubin
1327752725 engine: resources: Special log message for unhandled decline
Not sure why a PXE client is sending these... Not sure if it's buggy
firmware or my inability to handle a DHCP corner case.
2024-09-10 23:22:47 -04:00
James Shubin
118f266211 lang: core: local: Add a new vardir function
This gives us a function to return a created vardir folder. It is not
locally namespaced, and a future function will have to namespace one to
each scope.
2024-09-09 18:04:18 -04:00
James Shubin
87a2dfc8f9 engine: local: Add a vardir API to our local API collection 2024-09-09 17:41:12 -04:00
James Shubin
b88ac4603f lang: interfaces Add CallableFunc interface
Add a new interface for callable functions. This will likely be useful
for future versions of the function engine and for the "timeless" work.
2024-09-09 15:49:57 -04:00
James Shubin
28e81bcca3 modules: Add a modules directory for mcl code
Details in the README file.
2024-09-09 15:14:33 -04:00
James Shubin
3d0660559e examples: lang: Add a join example
Good reminder that a lot of the golang stdlib functions are available.
2024-09-09 14:54:45 -04:00
James Shubin
48dc9ad099 test: shell: Disable another flaky test
We need to fix these all eventually, but that day is not today.
2024-09-06 16:24:28 -04:00
James Shubin
fd3a2a1f0f engine: resources: Make consul optional
Licensing has made this non-free. Let's put that behind a build tag for
now, and remove it entirely if no suitable libre replacement is found.
2024-09-03 20:26:38 -04:00
James Shubin
c6e9175e3f engine: resources: Add missing build tag 2024-09-03 20:21:31 -04:00
James Shubin
1a39472734 lang: core: embedded: provisioner: Sometimes this is used
We need better overview of all the PXE/netboot stuff, probably we should
read a spec, but until an expert comes along, we'll have to proceed
incrementally.
2024-09-03 14:48:38 -04:00
James Shubin
bfa88e9b1c engine: resources: Workaround regression in wget2
Apparently wget2 has a serious regression that the HTTP 102 header
throws it off... So let's not send this for now... I'm pretty unhappy
about this, wget used to always be rock solid. Maybe curl deserves a
chance? (This works fine with curl btw.)
2024-08-30 20:33:41 -04:00
James Shubin
a0972c0752 lang, engine: Add a metaparam for catching accidental dollar signs
Let's make our life easier for users!
2024-08-22 20:41:48 -04:00
James Shubin
8dc0d44513 lang: Add an extra fail scenario to our test suite
Let's us write tests for Validate failures.
2024-08-22 20:12:59 -04:00
James Shubin
8594b6e2a9 lang: funcs: Hint the struct_lookup functions better
If we have static information, use it to help unification.
2024-08-21 19:00:51 -04:00
James Shubin
82cac572ca lang: core: fmt: Allow type unification variables for format
This allows some simple cases.
2024-08-21 19:00:50 -04:00
James Shubin
da4f69cd87 lang: ast, core: fmt: Allow unification variables for fmt
This lets us pass through unification variables into the fmt function. I
hope this doesn't break anything, but it's worth trying for now.
2024-08-21 18:52:24 -04:00
James Shubin
e6cb776eb6 lang: ast, core: fmt: Catch invalid nil signatures
We accidentally had a bad error triggered.
2024-08-21 18:50:11 -04:00
James Shubin
7557114b4e lang: ast: Don't send empty ord names for partials
We would accidentally send some empty partials, woops! This reinforces
my belief that we should never pre-allocate list size unless we notice a
performance issue.
2024-08-21 18:00:44 -04:00
James Shubin
001e1a5da0 lang: Remove some error wrapping
Makes errors cleaner to read. The extra context wasn't very helpful.
2024-08-18 19:07:27 -04:00
James Shubin
6f3c3c318b lang: core: Shorten functions with wrapper
This demonstrates how to write a function with the wrapper. Note that
you must not include Init if you're not calling the nested wrapper
function.
2024-08-18 18:29:01 -04:00
James Shubin
654e376be7 lang: core: Add list and map packages
Put the common functionality for those types in there.
2024-08-18 18:28:26 -04:00
James Shubin
211121cdca lang: funcs: Use correct constant 2024-08-18 17:31:58 -04:00
James Shubin
f2d4cac92d docs: Add a short contributing guide
I think this is all common sense, but I thought it might be helpful for
anyone that might not be well-versed with how such projects run.
2024-08-16 23:57:38 -04:00
James Shubin
c5dc9c7650 docs: Add a guide for writing API services
Hopefully this is useful to companies who want to design their services
properly to support modern tooling.
2024-08-16 23:38:27 -04:00
James Shubin
7596f5b572 lang: core: os: Add family functions and variables
Make it easier to do os-specific stuff.
2024-08-07 17:30:15 -04:00
James Shubin
8e9c3b6c1e lang: funcs: vars: Include system package variables in the scope 2024-08-07 17:30:13 -04:00
James Shubin
a93c98402a lang: ast: Add better logging about scope issues
This may help out programmers who aren't sure what's going on.
2024-08-07 17:17:57 -04:00
James Shubin
b04ee4ba22 lang: ast: Pass through the data field for vars 2024-08-07 17:17:57 -04:00
James Shubin
65b104ea55 lang: ast: Split off helpers into util file 2024-08-07 17:17:57 -04:00
James Shubin
562eb643fc engine: resources: Display bytes copied when making a file 2024-08-06 15:24:45 -04:00
James Shubin
80178422db engine: graph, resources: Clean up log messages
The idea is to have a better user experience in the terminal.
2024-08-06 15:12:10 -04:00
James Shubin
e94f39bf2c engine: resources: Cleanups to the svc resource
Some new API's exist that take a context now too!
2024-08-06 14:31:39 -04:00
James Shubin
6c1a33066a engine: resources: The svc resource should reload on notification
Missing feature that is finally landing. I wish this wasn't needed, but
we need fancier plumbing to avoid it.
2024-08-06 14:22:15 -04:00
James Shubin
beca0c3ae6 engine: resources: Plumb through the context and constants
Basically a small cleanup.
2024-08-06 14:13:39 -04:00
James Shubin
7517c83953 engine: resources: Add the systemd service constants
Basically a cleanup to avoid duplicate strings everywhere. This makes it
easier to follow the code too.
2024-08-06 14:02:17 -04:00
James Shubin
0354082f89 engine: resources: Allow symbolic modes for missing files
In 83a747794e a bug was introduced with
the implementation of symbolic modes, that would prevent a file resource
from passing the Validate step if you were using a symbolic mode, and
the file didn't already exist. If you didn't use symbolic modes and
those files weren't absent, then you wouldn't have noticed.

It might be worth looking into the API for symbolic parsing as well.
2024-08-06 13:24:25 -04:00
James Shubin
4abcd9cf01 lang: core: Quiet down the template function by default
We don't need to know this most of the time.
2024-08-01 20:54:55 -04:00
James Shubin
c974820c56 engine: resources: Add log messages for chmod and chown 2024-08-01 20:32:56 -04:00
James Shubin
88670ae7a1 engine: resources: Improve output of log messages
I don't remember ever having this display a pointer address, but it is
now, so let's make this cleaner.
2024-08-01 18:44:44 -04:00
James Shubin
d0ed004b24 examples: lang: Test that each of the mcl examples compiles
We let these rot, so fixup the issues and test them!
2024-07-31 17:29:42 -04:00
James Shubin
6de7d8b254 lang: funcs: Catch non-specific type build error
If you had ambiguous code, and specified an invalid type, this could
sneak through and become a runtime error, instead of a compile-time
error. We fix this and add a test.
2024-07-31 17:29:42 -04:00