Monthly Archives: October 2012

Prismscript updates expected this week

I need to start posting more regularly, so here are some words.

Prismscript should be getting a somewhat significant change to its Interpreter initialiser, in that some specialised config options will be dropped and a new interpreter_location=None parameter will be added. If provided, it must be a string that will give the interpreted script a scoped reference to the interpreter’s config-object, which will allow for tuning and behavioural options to be configured based on scripting logic.

How this will work is that the interpreter will expose a get_config() method that returns the new config-object, and this object will expose attributes like preemptable (a boolean value that causes the interpreter to yield after each statement, so that the caller can easily trigger script-asynchronous events without crazy threading solutions), and things like recursion_limit (an integer, bounded by a caller-set maximum, that will let script-code set its own tolerances). There’s a good chance some form of exception-handling will be added, too.

Additionally, a yield keyword will be added to the language proper, allowing for the script to yield of its own volition where needed. The yielded value will be wrapped in a special object, though the semantics have not yet been decided.

After these changes are in place and testing has occurred, versioning will increase to 1.1.0, which is when the first release archive should be published.

staticDHCPd 1.6.0 (beta)

staticDHCPd 1.6.0 is now in testing, adding support for, surprisingly, dynamic provisioning.

This isn’t a new focus for the project, but a request came in and it seemed pretty easy to do it in a way that leaves all of the dynamic messiness in the domain of site-specific configuration code, without changing the internals one bit. This was accomplished by adding a new hook-function to conf.py that gets triggered whenever a MAC isn’t found in the database, offering a chance for custom code to synthesise a record. Injecting a record at this point is, to the rest of the architecture, the same as having found it in the database, so yay for well-factored designs.

The gist of this is that, if you want to provision things on the fly, whether permanently or not, or if you just want to send yourself an SMS, or both, or something else that’s totally wild, you’ve now got the facilities to do so. Have fun and let me know what, if anything, breaks.

An in-memory example of dynamic provisioning is in the 1.6.0 codebase and its usage is described on the project wiki, under the FAQ and new dynamism page.

Also new is a DAEMON option, allowing you to decide whether you want to run the process as a true daemon or keep its controlling terminal for testing purposes. Daemon mode ships enabled in new config files, but defaults to disabled in older ones, since it was up to the initscript/policy to handle that before, but that’s kinda silly.