ISC DHCP - using omapi to subclass hosts

There have been a considerable number of posts on the Internet asking about how to use omshell to 'subclass' dynamically added hosts

So far, I have yet to see anyone post a way to do this. Finally, I broke down and started poking through the ISC DHCP source code, and what I found suggests that the code for OMAPI shuld support it, but as of ISC DHCP 4.1-ESV R4, it doesn't appear to be functional.

However, I do have good news: I found a workaround that accomplishes the same thing!

omshell <<CMD
  server SERVERIP

  new host
    set name = "NEWCLIENT"
    set hardware-address = 00:11:22:33:44:55
    set hardware-type = 1
    set statements = "subclass 'CLASSNAME' 1:00:11:22:33:44:55;"

(This assumes that the dhcp configuration file already has the following in it:)

NOTE: This is not an perfect solution: it adds some bloat to the leases file. Caveat Emptor!
If you are building your DHCP config from information in a database (and you're updating your database as well), then you'll want to periodically cleanup the leases file as part of the rebuild.